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 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