Skip to main content

random_bytes_mixed

Function random_bytes_mixed 

Source
pub fn random_bytes_mixed() -> Result<[u8; 32], EntropyHealthError>
Expand description

Generates 32 bytes of mixed entropy from multiple sources.

Sources:

  • OS randomness (getrandom/urandom via rand crate)
  • CPU randomness (RDRAND on x86_64 if available)
  • Timing jitter (high-resolution timestamps with spin loops)
  • Process context (PID, thread ID, memory addresses)

All sources are mixed through BLAKE2b-512, truncated to 32 bytes.

Returns an error if the RNG health check fails.