[][src]Struct ratchet::Ratchet

pub struct Ratchet<Digest, StateSize, OutputSize, Rounds = U1> where
    StateSize: ArrayLength<u8>,
    OutputSize: ArrayLength<u8>, 
{ /* fields omitted */ }

A HKDF Ratchet which can be used to produce cyptographically secure pseudo random bytes.

Methods

impl<D, S, O, R> Ratchet<D, S, O, R> where
    S: ArrayLength<u8>,
    O: ArrayLength<u8>, 
[src]

pub fn new<Rand>(rand: &mut Rand) -> Self where
    Rand: RngCore + CryptoRng
[src]

Creates a new Ratchet from random state.

Params

rand --- The source of random state.

pub fn reseed<Rand>(&mut self, rand: &mut Rand) where
    Rand: RngCore + CryptoRng
[src]

Reseeds the Ratchet with random state.

Params

rand --- The source of randomness.

impl<D, S, O, R> Ratchet<D, S, O, R> where
    D: Input + BlockInput + FixedOutput + Reset + Default + Clone,
    S: ArrayLength<u8> + Sub<D::BlockSize> + Add<O>,
    O: ArrayLength<u8>,
    R: Unsigned + NonZero,
    D::BlockSize: Clone,
    Sum<S, O>: ArrayLength<u8>,
    Diff<S, D::BlockSize>: Unsigned, 
[src]

pub fn next(&mut self) -> GenericArray<u8, O>[src]

Generates the next pseudo random byte.

Trait Implementations

impl<D, S, O, R> Clone for Ratchet<D, S, O, R> where
    S: ArrayLength<u8>,
    O: ArrayLength<u8>, 
[src]

impl<D, S, O, R> CryptoRng for Ratchet<D, S, O, R> where
    S: ArrayLength<u8>,
    O: ArrayLength<u8>, 
[src]

impl<D, S, O, R> Default for Ratchet<D, S, O, R> where
    S: ArrayLength<u8>,
    O: ArrayLength<u8>, 
[src]

impl<'a, D, S, O, R> From<&'a mut [u8]> for Ratchet<D, S, O, R> where
    S: ArrayLength<u8>,
    O: ArrayLength<u8>, 
[src]

fn from(state: &'a mut [u8]) -> Self[src]

Creates a new Ratchet from state bytes.

If state is too short it will be padded.
state will be cleared after creation.

Params

state --- The initial state data.

impl<D, S, O, R, A> Generator<A> for Ratchet<D, S, O, R> where
    S: ArrayLength<u8>,
    O: ArrayLength<u8>,
    Self: Iterator<Item = GenericArray<u8, O>> + Unpin
[src]

type Yield = GenericArray<u8, O>

🔬 This is a nightly-only experimental API. (generator_trait)

The type of value this generator yields. Read more

type Return = !

🔬 This is a nightly-only experimental API. (generator_trait)

The type of value this generator returns. Read more

impl<D, S, O, R> Iterator for Ratchet<D, S, O, R> where
    D: Input + BlockInput + FixedOutput + Reset + Default + Clone,
    S: ArrayLength<u8> + Sub<D::BlockSize> + Add<O>,
    O: ArrayLength<u8>,
    R: Unsigned + NonZero,
    D::BlockSize: Clone,
    Sum<S, O>: ArrayLength<u8>,
    Diff<S, D::BlockSize>: Unsigned, 
[src]

type Item = GenericArray<u8, O>

The type of the elements being iterated over.

impl<D, S, O, R> RngCore for Ratchet<D, S, O, R> where
    S: ArrayLength<u8>,
    O: ArrayLength<u8>,
    Self: Iterator<Item = GenericArray<u8, O>>, 
[src]

impl<D, S, O, R> SeedableRng for Ratchet<D, S, O, R> where
    S: ArrayLength<u8>,
    O: ArrayLength<u8>, 
[src]

type Seed = GenericArray<u8, S>

Seed type, which is restricted to types mutably-dereferencable as u8 arrays (we recommend [u8; N] for some N). Read more

impl<D, S, O, R> TrustedLen for Ratchet<D, S, O, R> where
    S: ArrayLength<u8>,
    O: ArrayLength<u8>,
    Self: Iterator
[src]

Auto Trait Implementations

impl<Digest, StateSize, OutputSize, Rounds> RefUnwindSafe for Ratchet<Digest, StateSize, OutputSize, Rounds> where
    Digest: RefUnwindSafe,
    OutputSize: RefUnwindSafe,
    Rounds: RefUnwindSafe,
    <StateSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe

impl<Digest, StateSize, OutputSize, Rounds> Send for Ratchet<Digest, StateSize, OutputSize, Rounds> where
    Digest: Send,
    OutputSize: Send,
    Rounds: Send

impl<Digest, StateSize, OutputSize, Rounds> Sync for Ratchet<Digest, StateSize, OutputSize, Rounds> where
    Digest: Sync,
    OutputSize: Sync,
    Rounds: Sync

impl<Digest, StateSize, OutputSize, Rounds> Unpin for Ratchet<Digest, StateSize, OutputSize, Rounds> where
    Digest: Unpin,
    OutputSize: Unpin,
    Rounds: Unpin,
    <StateSize as ArrayLength<u8>>::ArrayType: Unpin

impl<Digest, StateSize, OutputSize, Rounds> UnwindSafe for Ratchet<Digest, StateSize, OutputSize, Rounds> where
    Digest: UnwindSafe,
    OutputSize: UnwindSafe,
    Rounds: UnwindSafe,
    <StateSize as ArrayLength<u8>>::ArrayType: UnwindSafe

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> Clear for T where
    T: InitializableFromZeroed + ?Sized
[src]

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

impl<T> InitializableFromZeroed for T where
    T: Default
[src]

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.