pub trait StreamCipher {
const KEY_SIZE: usize;
const NONCE_SIZE: usize;
const BLOCK_SIZE: usize;
// Required methods
fn process(&mut self, data: &mut [u8]) -> Result<()>;
fn keystream(&mut self, output: &mut [u8]) -> Result<()>;
fn reset(&mut self) -> Result<()>;
fn seek(&mut self, position: u64) -> Result<()>;
// Provided methods
fn encrypt(&mut self, data: &mut [u8]) -> Result<()> { ... }
fn decrypt(&mut self, data: &mut [u8]) -> Result<()> { ... }
}
Expand description
Common trait for stream cipher implementations
Required Associated Constants§
Sourceconst NONCE_SIZE: usize
const NONCE_SIZE: usize
The nonce size in bytes
Sourceconst BLOCK_SIZE: usize
const BLOCK_SIZE: usize
The internal block size in bytes (if applicable)
Required Methods§
Sourcefn process(&mut self, data: &mut [u8]) -> Result<()>
fn process(&mut self, data: &mut [u8]) -> Result<()>
Process data in place (encrypts for encryption, decrypts for decryption)
Provided Methods§
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.