Skip to main content

Entropy

Trait Entropy 

Source
pub trait Entropy {
    // Required method
    fn fill(&mut self, dest: &mut [u8]);
}
Expand description

A source of random bytes, injected by the host (core reads no clock and no OS source).

use laminapdf_syntax::crypt::{Entropy, SeededEntropy};

let mut a = SeededEntropy::new([7; 32]);
let mut b = SeededEntropy::new([7; 32]);
let (mut x, mut y) = ([0u8; 40], [0u8; 40]);
a.fill(&mut x);
b.fill(&mut y);
assert_eq!(x, y);

Added in 0.7.0.

Required Methods§

Source

fn fill(&mut self, dest: &mut [u8])

Fills dest with random bytes.

Added in 0.7.0.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§