pub trait BlockCipher {
const BLOCK_LEN: usize;
const KEY_LENS: &'static [usize];
// Required methods
fn new(key: &[u8]) -> Self;
fn encrypt_block(&self, block: &mut [u8]);
fn decrypt_block(&self, block: &mut [u8]);
}Expand description
Trait for symmetric block ciphers operating on a fixed block size.
Implementors include the AES family (cipher::Aes, cipher::Aes128,
cipher::Aes192, cipher::Aes256) and the DES family
(cipher::Des, cipher::TripleDes).
Required Associated Constants§
Required Methods§
Sourcefn new(key: &[u8]) -> Self
fn new(key: &[u8]) -> Self
Initialise the cipher with a key. The key length must be one of
the values listed in Self::KEY_LENS.
Sourcefn encrypt_block(&self, block: &mut [u8])
fn encrypt_block(&self, block: &mut [u8])
Encrypt block in place. The slice must be at least
Self::BLOCK_LEN bytes long.
Sourcefn decrypt_block(&self, block: &mut [u8])
fn decrypt_block(&self, block: &mut [u8])
Decrypt block in place. The slice must be at least
Self::BLOCK_LEN bytes long.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".