Skip to main content

RngPlugin

Trait RngPlugin 

Source
pub trait RngPlugin: Sized {
    // Required methods
    fn create(
        algorithm: &str,
        opts: Option<OptionView<'_>>,
    ) -> PluginResult<Self>;
    fn reseed(&mut self, data: &[u8]) -> PluginResult<()>;
    fn add_entropy(&mut self, data: &[u8]) -> PluginResult<()>;
    fn generate(&mut self, out: &mut [u8]) -> PluginResult<()>;
}
Expand description

Trait implemented by RNG plugins.

Required Methods§

Source

fn create(algorithm: &str, opts: Option<OptionView<'_>>) -> PluginResult<Self>

Construct a new RNG instance for the named algorithm.

Source

fn reseed(&mut self, data: &[u8]) -> PluginResult<()>

Reseed the generator from the provided entropy.

Source

fn add_entropy(&mut self, data: &[u8]) -> PluginResult<()>

Add entropy without a full reseed.

Source

fn generate(&mut self, out: &mut [u8]) -> PluginResult<()>

Fill out with random bytes.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§