pub struct ChaCha20 { /* private fields */ }Expand description
The ChaCha20 stream cipher.
Implementations§
Source§impl ChaCha20
impl ChaCha20
Sourcepub fn new(key: [u8; 32], nonce: [u8; 12], seek: u32) -> Self
pub fn new(key: [u8; 32], nonce: [u8; 12], seek: u32) -> Self
Make a new instance of ChaCha20 from an index in the keystream.
Sourcepub fn new_from_block(key: [u8; 32], nonce: [u8; 12], block: u32) -> Self
pub fn new_from_block(key: [u8; 32], nonce: [u8; 12], block: u32) -> Self
Make a new instance of ChaCha20 from a block in the keystream.
Sourcepub fn apply_keystream<'a>(&'a mut self, to: &'a mut [u8]) -> &[u8]
pub fn apply_keystream<'a>(&'a mut self, to: &'a mut [u8]) -> &[u8]
Apply the keystream to a message.
Sourcepub fn get_keystream(&mut self, block: u32) -> [u8; 64]
pub fn get_keystream(&mut self, block: u32) -> [u8; 64]
Get the keystream block at a specified block.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChaCha20
impl RefUnwindSafe for ChaCha20
impl Send for ChaCha20
impl Sync for ChaCha20
impl Unpin for ChaCha20
impl UnwindSafe for ChaCha20
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