Skip to main content

CryptoRng

Trait CryptoRng 

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

A simple RNG trait for randomized nonce generation and key generation.

Implementors fill the supplied buffer with cryptographically strong pseudo-random bytes. The trait is deliberately minimal (no fn try_fill_bytes returning Result, no error type) to keep the public surface small. Callers running on platforms where the underlying entropy source can fail should provide a wrapper that panics or aborts on failure.

Required Methods§

Source

fn fill_bytes(&mut self, dest: &mut [u8])

Fill dest with cryptographically random bytes.

Implementors§