pub trait ChaCha12 {
type Context: Send + Sync + Clone;
// Required methods
fn init(key: &[u8; 32], nonce: &[u8; 12], counter: u32) -> Self::Context;
fn apply_keystream(ctx: &mut Self::Context, buf: InOutBuf<'_, '_, u8>);
}Expand description
ChaCha12 (12 rounds) stream cipher driver.
Required Associated Types§
Required Methods§
Sourcefn init(key: &[u8; 32], nonce: &[u8; 12], counter: u32) -> Self::Context
fn init(key: &[u8; 32], nonce: &[u8; 12], counter: u32) -> Self::Context
Initialize with a 256-bit key, a 96-bit nonce and the initial 32-bit block counter.
Sourcefn apply_keystream(ctx: &mut Self::Context, buf: InOutBuf<'_, '_, u8>)
fn apply_keystream(ctx: &mut Self::Context, buf: InOutBuf<'_, '_, u8>)
XOR the keystream into buf.
The counter and any unused keystream are carried in the context, so
buf need not be block-aligned.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".