pub struct ChaChaOriginal<const ROUNDS: usize> { /* private fields */ }Expand description
ChaCha Context (Original version - Bernstein & co)
This variant has an 8 bytes nonce initializer, and an 8 bytes counter
Note that the number of rounds is exposed here, and only the value of 8, 12 and 20 are supported. any other values triggers a runtime assertion.
If you don’t know what round values to use, use 20
Implementations§
Source§impl<const ROUNDS: usize> ChaChaOriginal<ROUNDS>
impl<const ROUNDS: usize> ChaChaOriginal<ROUNDS>
Sourcepub fn new(key: &[u8], nonce: &[u8; 8]) -> Self
pub fn new(key: &[u8], nonce: &[u8; 8]) -> Self
Create a new ChaCha20 context.
- The key must be 16 or 32 bytes
- The nonce must be 8 bytes
For using 12 bytes (96 bits) nonces, uses the IETF variant ChaCha
Sourcepub fn process_mut(&mut self, data: &mut [u8])
pub fn process_mut(&mut self, data: &mut [u8])
Process the input in place through the cipher xoring
To get only the stream of this cipher, one can just pass the zero buffer (X xor 0 = X)
Trait Implementations§
Source§impl<const ROUNDS: usize> Clone for ChaChaOriginal<ROUNDS>
impl<const ROUNDS: usize> Clone for ChaChaOriginal<ROUNDS>
Source§fn clone(&self) -> ChaChaOriginal<ROUNDS>
fn clone(&self) -> ChaChaOriginal<ROUNDS>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<const ROUNDS: usize> Freeze for ChaChaOriginal<ROUNDS>
impl<const ROUNDS: usize> RefUnwindSafe for ChaChaOriginal<ROUNDS>
impl<const ROUNDS: usize> Send for ChaChaOriginal<ROUNDS>
impl<const ROUNDS: usize> Sync for ChaChaOriginal<ROUNDS>
impl<const ROUNDS: usize> Unpin for ChaChaOriginal<ROUNDS>
impl<const ROUNDS: usize> UnsafeUnpin for ChaChaOriginal<ROUNDS>
impl<const ROUNDS: usize> UnwindSafe for ChaChaOriginal<ROUNDS>
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