class Sodium::CryptoBox
- Sodium::CryptoBox
- Reference
- Object
Overview
Use Sodium::CryptoBox::SecretKey#box
Included Modules
- Sodium::Wipe
Defined in:
sodium/crypto_box.crsodium/crypto_box/public_key.cr
sodium/crypto_box/secret_key.cr
Constant Summary
-
MAC_SIZE =
LibSodium.crypto_box_macbytes.to_i
Instance Method Summary
-
#decrypt(src : Bytes, dst = Bytes.new(src.bytesize - MAC_SIZE), nonce = Nonce.random) : Bytes
Returns decrypted message.
-
#decrypt(src)
Returns decrypted message.
-
#encrypt(src : Bytes, dst = Bytes.new(src.bytesize + MAC_SIZE), nonce = Nonce.random) : Tuple(Bytes, Nonce)
Encrypts data and returns {ciphertext, nonce}
-
#encrypt(src)
Encrypts data and returns {ciphertext, nonce}
Instance Method Detail
Returns decrypted message.
Optionally supply a destination buffer.