abstract class Sodium::Cipher::Aead::Chalsa

Direct Known Subclasses

Defined in:

sodium/cipher/aead/chalsa.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(key : SecureBuffer) #

Initializes with a reference to an existing key.


[View source]
def self.new(bytes : Bytes, erase = false) #

Initializes copying the key to a SecureBuffer.


[View source]
def self.new #

Initializes with a new random key.


[View source]

Instance Method Detail

def decrypt(src, dst : Bytes? = nil, *, nonce : Nonce, additional = nil) : Bytes #

Decrypts src and returns plaintext Must supply nonce Must supply additional if supplied to #encrypt


[View source]
def decrypt_detached(src, dst : Bytes? = nil, *, nonce = nil, mac : Bytes? = nil, additional = nil) : Bytes #

Decrypts src and returns plaintext Must supply mac and nonce Must supply additional if supplied to #encrypt


[View source]
abstract def decrypt_detached(src : Bytes, dst : Bytes? = nil, *, nonce : Sodium::Nonce, mac : Bytes, additional : String | Bytes | Nil = nil) : Bytes #

[View source]
def decrypt_detached_string(src, dst : Bytes? = nil, *, nonce = nil, mac : Bytes? = nil, additional = nil) : String #

Decrypts src and returns plaintext Must supply mac and nonce Must supply additional if supplied to #encrypt


[View source]
def decrypt_string(src, dst : Bytes? = nil, *, nonce : Nonce, additional = nil) : String #

Decrypts src and returns plaintext Must supply nonce Must supply additional if supplied to #encrypt


[View source]
def dup #
Description copied from class Reference

Returns a shallow copy of this object.

This allocates a new object and copies the contents of self into it.


[View source]
def encrypt(src, dst : Bytes? = nil, *, nonce = nil, additional = nil) #

Encrypts src and returns {ciphertext, nonce}


[View source]
abstract def encrypt_detached(src : Bytes, dst : Bytes? = nil, *, nonce : Sodium::Nonce? = nil, mac : Bytes? = nil, additional : String | Bytes | Nil = nil) : Tuple(Bytes, Bytes, Sodium::Nonce) #

[View source]
def encrypt_detached(src, dst : Bytes? = nil, *, nonce = nil, mac : Bytes? = nil, additional = nil) : Tuple(Bytes, Bytes, Nonce) #

Encrypts src and returns {mac, ciphertext, nonce}


[View source]
def key : SecureBuffer #

Encryption key


[View source]
abstract def key_size : Int32 #

[View source]
abstract def mac_size : Int32 #

[View source]
abstract def nonce_size : Int32 #

[View source]