pub trait CryptoRng {
// Required method
fn fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), MlKemError>;
}Expand description
Trait for cryptographic-quality random byte generation.
Implementations must provide bytes suitable for key material and nonces. The trait is intentionally minimal (a single method) to allow easy integration with external RNG libraries or hardware RNGs.
§Errors
Returns MlKemError::RngFailure if the underlying entropy source
is unavailable or fails.
Required Methods§
Sourcefn fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), MlKemError>
fn fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), MlKemError>
Fill dest with cryptographically secure random bytes.
§Errors
Returns MlKemError::RngFailure on failure.