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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.