pub trait NewCipher: Sized {
type KeySize: ArrayLength<u8>;
type NonceSize: ArrayLength<u8>;
// Required method
fn new(key: &CipherKey<Self>, nonce: &Nonce<Self>) -> Self;
// Provided method
fn new_from_slices(key: &[u8], nonce: &[u8]) -> Result<Self, InvalidLength> { ... }
}
Expand description
Cipher creation trait.
It can be used for creation of block modes, synchronous and asynchronous stream ciphers.
Required Associated Types§
sourcetype KeySize: ArrayLength<u8>
type KeySize: ArrayLength<u8>
Key size in bytes
sourcetype NonceSize: ArrayLength<u8>
type NonceSize: ArrayLength<u8>
Nonce size in bytes
Required Methods§
Provided Methods§
sourcefn new_from_slices(key: &[u8], nonce: &[u8]) -> Result<Self, InvalidLength>
fn new_from_slices(key: &[u8], nonce: &[u8]) -> Result<Self, InvalidLength>
Create new stream cipher instance from variable length key and nonce given as byte slices.