CSPRNG based on the ChaCha8 stream cipher, with forward security.

References:

  • Fast-key-erasure random-number generators https://blog.cr.yp.to/20170723-random.html

Fields

state: State,
offset: usize,

Functions

fn addEntropy(self: *Self, bytes: []const u8) void

Inserts entropy to refresh the internal state.

fn fill(self: *Self, buf_: []u8) void

Fills the buffer with random bytes.

fn init(secret_seed: [secret_seed_length]u8) Self

The seed must be uniform, secret and secret_seed_length bytes long.

fn random(self: *Self) Random

Returns a std.rand.Random structure backed by the current RNG.

Values