Skip to main content

RandomSource

Trait RandomSource 

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

A source of random bytes, supplied by the caller.

This module has no entropy source of its own: no OS RNG, no getrandom, nothing that would need a host bridge on a target like wasm32-unknown-unknown where none exists. A caller fills this from a CSPRNG it already holds, or from a fixed seed for reproducible tests.

Required Methods§

Source

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

Fill dest with bytes suitable for key material.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§