[−][src]Function monocypher::aead::unlock::aead
pub fn aead(
cipher_text: &[u8],
key: [u8; 32],
nonce: [u8; 24],
mac: [u8; 16],
ad: &[u8]
) -> Result<Vec<u8>, String>
Decrypt ciphertext with additional data.
Example
use monocypher::aead::{lock, unlock}; let plaintext = "plaintext"; let key = [137u8; 32]; let nonce = [120u8; 24]; let ad = "data"; let cymac = lock::aead(plaintext.as_bytes(), key, nonce, ad.as_bytes()); unlock::aead(&cymac.0, key, nonce, cymac.1, ad.as_bytes()).unwrap();