[][src]Struct enocoro128v2::Enocoro128

pub struct Enocoro128 { /* fields omitted */ }

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

impl Debug for Enocoro128[src]

impl Drop for Enocoro128[src]

impl Zeroize for Enocoro128[src]

Auto Trait Implementations

impl Send for Enocoro128

impl Sync for Enocoro128

impl Unpin for Enocoro128

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<Z> Zeroize for Z where
    Z: DefaultIsZeroes
[src]