[−][src]Struct enocoro128v2::Enocoro128
Composition of reference implementation's context, state, and buffer structures. Implements en/decryption and random (i.e. keystream getter) functions.
Methods
impl Enocoro128
[src]
pub fn new(key: &[u8; 16], iv: &[u8; 8]) -> Enocoro128
[src]
Constructor, note key and IV length are compile-time enforced.
pub fn init_keystream(&mut self)
[src]
Keystream initialization.
pub fn apply_keystream(&mut self, data: &mut [u8])
[src]
Stateful, in-place en/decryption (current keystream XORed with data). Can be called repeatedly to continue applying keystream to data chunks of varying sizes. For usecases where the entirety of the plaintext or ciphertext is never in memory at once (e.g. data received/transmitted in chunks, potentially of varying sizes).
pub fn apply_keystream_static(key: &[u8; 16], iv: &[u8; 8], data: &mut [u8])
[src]
Stateless, in-place en/decryption (keystream XORed with data). Uses an ephemeral instance of the cipher, zeroed on function return. For usecases where the entirety of the plaintext or ciphertext is in-memory at once.
pub fn rand_buf(&mut self, r: &mut [u8])
[src]
Fill arbitrary length buffer from keystream.
pub fn rand_u8(&mut self) -> u8
[src]
Get u8 from keystream.
pub fn rand_u16(&mut self) -> u16
[src]
Get u16 from keystream.
pub fn rand_u32(&mut self) -> u32
[src]
Get u32 from keystream.
pub fn rand_u64(&mut self) -> u64
[src]
Get u64 from keystream.
pub fn rand_u128(&mut self) -> u128
[src]
Get u128 from keystream.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<Z> Zeroize for Z where
Z: DefaultIsZeroes,
[src]
Z: DefaultIsZeroes,