abstract struct Sodium::Cipher::Aead::Chalsa
- Sodium::Cipher::Aead::Chalsa
- Struct
- Value
- Object
Direct Known Subclasses
Defined in:
sodium/cipher/aead/chalsa.crConstructors
-
.new(key : SecureBuffer)
Initializes with a reference to an existing key.
-
.new(bytes : Bytes, erase = false)
Initializes copying the key to a
SecureBuffer
. -
.new
DEPRECATED use .random instead of .new
Instance Method Summary
-
#decrypt(src, dst : Bytes | Nil = nil, *, nonce : Nonce, additional = nil) : Bytes
Decrypts
src
and returns plaintext Must supplynonce
Must supplyadditional
if supplied to #encrypt -
#decrypt_detached(src, dst : Bytes | Nil = nil, *, nonce = nil, mac : Bytes | Nil = nil, additional = nil) : Bytes
Decrypts
src
and returns plaintext Must supplymac
andnonce
Must supplyadditional
if supplied to #encrypt - #decrypt_detached(src : Bytes, dst : Bytes | Nil = nil, *, nonce : Sodium::Nonce, mac : Bytes, additional : String | Bytes | Nil = nil) : Bytes
-
#decrypt_detached_string(src, *, nonce = nil, mac : Bytes | Nil = nil, additional = nil) : String
Decrypts
src
and returns plaintext Must supplymac
andnonce
Must supplyadditional
if supplied to #encrypt -
#decrypt_secret(src, dst : Crypto::Secret | Nil = nil, *, nonce : Nonce, additional = nil) : Crypto::Secret
Decrypts
src
and returns plaintext as aCrypto::Secret
Must supplynonce
Must supplyadditional
if supplied to #encrypt -
#decrypt_string(src, *, nonce : Nonce, additional = nil) : String
Decrypts
src
and returns plaintext Must supplynonce
Must supplyadditional
if supplied to #encrypt -
#dup
Returns a shallow copy of this object.
-
#encrypt(src, dst : Bytes | Nil = nil, *, nonce = nil, additional = nil) : Tuple(Bytes, Nonce)
Encrypts
src
and returns {ciphertext, nonce} - #encrypt_detached(src : Bytes, dst : Bytes | Nil = nil, *, nonce : Sodium::Nonce | Nil = nil, mac : Bytes | Nil = nil, additional : String | Bytes | Nil = nil) : Tuple(Bytes, Bytes, Sodium::Nonce)
-
#encrypt_detached(src, dst : Bytes | Nil = nil, *, nonce = nil, mac : Bytes | Nil = nil, additional = nil) : Tuple(Bytes, Bytes, Nonce)
Encrypts
src
and returns {mac, ciphertext, nonce} -
#key : SecureBuffer
Encryption key
- #key_size : Int32
- #mac_size : Int32
- #nonce_size : Int32
Constructor Detail
Instance Method Detail
Decrypts src
and returns plaintext
Must supply nonce
Must supply additional
if supplied to #encrypt
Decrypts src
and returns plaintext
Must supply mac
and nonce
Must supply additional
if supplied to #encrypt
Decrypts src
and returns plaintext
Must supply mac
and nonce
Must supply additional
if supplied to #encrypt
Decrypts src
and returns plaintext as a Crypto::Secret
Must supply nonce
Must supply additional
if supplied to #encrypt
Decrypts src
and returns plaintext
Must supply nonce
Must supply additional
if supplied to #encrypt
Returns a shallow copy of this object.
Because Value
is a value type, this method returns self
,
which already involves a shallow copy of this object because
value types are passed by value.
Encrypts src
and returns {ciphertext, nonce}