pub trait BlockCipher {
const BLOCK_SIZE: usize;
// Required methods
fn new(key: &[u8]) -> Self;
fn encrypt_block(&self, block: &mut [u8]);
fn decrypt_block(&self, block: &mut [u8]);
}Expand description
A symmetric block cipher (single-block primitive).
Higher-level modes (CBC, CTR, GCM) compose on top by chaining
encrypt_block / decrypt_block calls; see
crate::sm4::mode_cbc for the v0.2 single-shot CBC and
crate::sm4::cbc_streaming for the v0.3 W5 streaming
Sm4CbcEncryptor / Sm4CbcDecryptor.
Required Associated Constants§
Sourceconst BLOCK_SIZE: usize
const BLOCK_SIZE: usize
Block size in bytes (e.g. 16 for SM4).
Required Methods§
Sourcefn encrypt_block(&self, block: &mut [u8])
fn encrypt_block(&self, block: &mut [u8])
Encrypt one block in place.
Sourcefn decrypt_block(&self, block: &mut [u8])
fn decrypt_block(&self, block: &mut [u8])
Decrypt one block in place.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".