pub trait Rng {
// Required method
fn rng_fill(&mut self, buf: &mut [u8]) -> Result<(), CryptoError>;
}Expand description
Caller-provided entropy source for crypto operations that need fresh randomness (ECDSA nonces, ephemeral key generation).
Object-safe so it can be passed as &mut dyn Rng into driver traits.
Production implementations wrap a hardware TRNG or a CSPRNG seeded from
one. Test code may inject a deterministic implementation (seeded DRBG or
fixed bytes) to get reproducible outputs for known-answer tests.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".