pub struct XSalsa20 { /* private fields */ }Expand description
XSalsa20 stream cipher with a 24-byte nonce.
A thin wrapper: it derives a subkey with HSalsa20 from the first 16
nonce bytes and runs Salsa20 with the derived key and the
remaining 8 nonce bytes.
Implementations§
Source§impl XSalsa20
impl XSalsa20
Sourcepub fn new(key: &[u8; 32], nonce: &[u8; 24], counter: u64) -> Self
pub fn new(key: &[u8; 32], nonce: &[u8; 24], counter: u64) -> Self
Initialise XSalsa20 with a 256-bit key, a 24-byte nonce, and an initial 64-bit block counter (usually 0).
Sourcepub fn apply_keystream(&mut self, data: &mut [u8])
pub fn apply_keystream(&mut self, data: &mut [u8])
XOR the keystream into data in place (symmetric: encrypt or
decrypt). Partial calls are buffered like Salsa20.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for XSalsa20
impl RefUnwindSafe for XSalsa20
impl Send for XSalsa20
impl Sync for XSalsa20
impl Unpin for XSalsa20
impl UnsafeUnpin for XSalsa20
impl UnwindSafe for XSalsa20
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