Skip to main content

CryptoRng

Trait CryptoRng 

Source
pub trait CryptoRng {
    // Required method
    fn fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), SlhDsaError>;
}
Expand description

Trait for cryptographic random byte generation.

Implementors must provide bytes that are indistinguishable from uniform random to any computationally bounded adversary. The default implementation (OsRng) reads from /dev/urandom.

Custom implementations can be provided for testing (deterministic RNG) or for environments where /dev/urandom is unavailable.

Required Methods§

Source

fn fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), SlhDsaError>

Fill dest with cryptographically secure random bytes.

Returns Err(SlhDsaError::RngFailure) if the entropy source is unavailable.

Implementors§

Source§

impl CryptoRng for OsRng

Available on crate feature std only.