Crate mgm[−][src]
Expand description
Generic implementation of Multilinear Galous Mode AEAD construction.
Example
use mgm::Mgm;
use kuznyechik::Kuznyechik;
use mgm::aead::{Aead, NewAead, generic_array::GenericArray};
let key = GenericArray::from_slice(b"very secret key very secret key ");
let cipher = Mgm::<Kuznyechik>::new(key);
// 127-bit nonce value, since API has to accept 128 bits, first nonce bit
// MUST be equal to zero, otherwise encryption and decryption will fail
let nonce = GenericArray::from_slice(b"unique nonce val");
// NOTE: handle errors to avoid panics!
let ciphertext = cipher.encrypt(nonce, b"plaintext message".as_ref())
.expect("encryption failure!");
let plaintext = cipher.decrypt(nonce, ciphertext.as_ref())
.expect("decryption failure!");
assert_eq!(&plaintext, b"plaintext message");
Re-exports
pub use aead;
Structs
Multilinear Galous Mode cipher
Traits
Trait implemented for block cipher sizes usable with MGM.