pub trait BlockCipher<W: Word, const N: usize> {
// Required methods
fn control_block_version(&self) -> String;
fn block_size(&self) -> usize;
fn word_size(&self) -> usize;
fn generate_blocks(&self, pt: Vec<u8>) -> Vec<[W; N]>;
fn generate_bytes_stream(&self, blocks: Vec<[W; N]>) -> Vec<u8> ⓘ;
fn encrypt(&self, pt: [W; N]) -> [W; N];
fn decrypt(&self, ct: [W; N]) -> [W; N];
}Expand description
Required Methods§
Sourcefn control_block_version(&self) -> String
fn control_block_version(&self) -> String
Human‐readable version tag, mostly a parametric version. e.g. in RC5-block-cipher “RC5-32/12/16”.
Sourcefn block_size(&self) -> usize
fn block_size(&self) -> usize
Base block-size in bytes for a block-cipher.
Sourcefn generate_blocks(&self, pt: Vec<u8>) -> Vec<[W; N]>
fn generate_blocks(&self, pt: Vec<u8>) -> Vec<[W; N]>
Split a byte‐vector into a Vec of length-N word blocks.
More generally, it creates a list of blocks from a stream of
plain bytes.
Sourcefn generate_bytes_stream(&self, blocks: Vec<[W; N]>) -> Vec<u8> ⓘ
fn generate_bytes_stream(&self, blocks: Vec<[W; N]>) -> Vec<u8> ⓘ
Generates a stream of bytes from a list of blocks. More
specefically from N word blocks list generates byte-vector.
Its counterfiet of generate_blocks method.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".