addEntropy
Inserts entropy to refresh the internal state.
Function parameters
Parameters
- self:*Self
- bytes:[]const u8
The seed must be uniform, secret and `secret_seed_length` bytes long.
Functions
- init
- The seed must be uniform, secret and `secret_seed_length` bytes long.
- addEntropy
- Inserts entropy to refresh the internal state.
- random
- Returns a `std.Random` structure backed by the current RNG.
- fill
- Fills the buffer with random bytes.
= 32
Values
Source
Implementation
pub fn addEntropy(self: *Self, bytes: []const u8) void {
comptime std.debug.assert(secret_seed_length % rate == 0);
var i: usize = 0;
while (i + rate < bytes.len) : (i += rate) {
self.state.addBytes(bytes[i..][0..rate]);
self.state.permuteR(8);
}
if (i != bytes.len) self.state.addBytes(bytes[i..]);
self.state.permute();
}