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§
Sourcefn create(algorithm: &str, opts: Option<OptionView<'_>>) -> PluginResult<Self>
fn create(algorithm: &str, opts: Option<OptionView<'_>>) -> PluginResult<Self>
Construct a new RNG instance for the named algorithm.
Sourcefn reseed(&mut self, data: &[u8]) -> PluginResult<()>
fn reseed(&mut self, data: &[u8]) -> PluginResult<()>
Reseed the generator from the provided entropy.
Sourcefn add_entropy(&mut self, data: &[u8]) -> PluginResult<()>
fn add_entropy(&mut self, data: &[u8]) -> PluginResult<()>
Add entropy without a full reseed.
Sourcefn generate(&mut self, out: &mut [u8]) -> PluginResult<()>
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".