Module sodiumoxide::crypto::secretbox::xsalsa20poly1305 [] [src]

crypto_secretbox_xsalsa20poly1305, a particular combination of Salsa20 and Poly1305 specified in Cryptography in NaCl.

This function is conjectured to meet the standard notions of privacy and authenticity.

Structs

Key

Key for symmetric authenticated encryption

Nonce

Nonce for symmetric authenticated encryption

Constants

KEYBYTES

Number of bytes in Key.

MACBYTES

Number of bytes in the authenticator tag of an encrypted message i.e. the number of bytes by which the ciphertext is larger than the plaintext.

NONCEBYTES

Number of bytes in a Nonce.

Functions

gen_key

gen_key() randomly generates a secret key

gen_nonce

gen_nonce() randomly generates a nonce

open

open() verifies and decrypts a ciphertext c using a secret key k and a nonce n. It returns a plaintext Ok(m). If the ciphertext fails verification, open() returns Err(()).

seal

seal() encrypts and authenticates a message m using a secret key k and a nonce n. It returns a ciphertext c.