pub struct ChaCha8 { /* private fields */ }Expand description
ChaCha8: ChaCha with 8 rounds.
Stream cipher with a 256-bit key, a 96-bit nonce and a 32-bit block counter. Encryption and decryption are the same operation. Data of any length is accepted, in any number of calls: the keystream position is kept across calls. The (key, nonce) pair must never be reused.
Implementations§
Source§impl ChaCha8
impl ChaCha8
Sourcepub const NONCE_SIZE: usize = 12
pub const NONCE_SIZE: usize = 12
Size of the nonce, in bytes.
Sourcepub fn new(key: &[u8; 32], nonce: &[u8; 12]) -> Self
pub fn new(key: &[u8; 32], nonce: &[u8; 12]) -> Self
Initialize with key and nonce, starting at block counter 0.
Sourcepub fn with_counter(key: &[u8; 32], nonce: &[u8; 12], counter: u32) -> Self
pub fn with_counter(key: &[u8; 32], nonce: &[u8; 12], counter: u32) -> Self
Initialize with key and nonce, starting at block counter.
Sourcepub fn apply_keystream(&mut self, buf: &mut [u8])
pub fn apply_keystream(&mut self, buf: &mut [u8])
XOR the keystream into buf.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ChaCha8
impl !Unpin for ChaCha8
impl !UnwindSafe for ChaCha8
impl Freeze for ChaCha8
impl Send for ChaCha8
impl Sync for ChaCha8
impl UnsafeUnpin for ChaCha8
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more