View Source CtrDrbg (ctr_drbg v0.1.1)

Pure Elixir implementation of the CTR_DRBG PRNG algorithm.

Examples

iex> state = CtrDrbg.init(:crypto.strong_rand_bytes(16))
iex> {state, random_bytes} = CtrDrbg.generate(state, 32)
{#CtrDrbg<...>, <<...>>}

Summary

Types

t()

The current PRNG state.

Functions

Generate an arbitrary number of random bytes.

Initialize and seed the generator.

Types

@opaque t()

The current PRNG state.

Functions

Link to this function

generate(state, length \\ 16, additional_entropy_input \\ <<>>)

View Source
@spec generate(t(), pos_integer(), binary()) :: {t(), binary()}

Generate an arbitrary number of random bytes.

Link to this function

init(entropy, pstring \\ <<>>)

View Source
@spec init(binary(), binary()) :: t()

Initialize and seed the generator.

Link to this function

reseed(state, seed, additional_entropy_input \\ <<>>)

View Source
@spec reseed(t(), binary(), binary()) :: t()

Reseed the generator.