Skip to main content

Entropy

Trait Entropy 

Source
pub trait Entropy:
    Send
    + Sync
    + Debug {
    // Required method
    fn fill(&self, buf: &mut [u8]) -> Result<(), Error>;

    // Provided method
    fn seed(&self) -> Result<[u8; 32], Error> { ... }
}
Expand description

A source of random bytes.

Required Methods§

Source

fn fill(&self, buf: &mut [u8]) -> Result<(), Error>

Fills buf with fresh random bytes.

Fails only when the source is unavailable. A caller refuses the operation then, never falls back to a clock: a clock-derived nonce risks the collision the nonce exists to prevent, and a clock-derived credential is guessable.

Provided Methods§

Source

fn seed(&self) -> Result<[u8; 32], Error>

A fresh identity seed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§