pub struct EntropyPool { /* private fields */ }Expand description
Thread-safe multi-source entropy pool.
Implementations§
Source§impl EntropyPool
impl EntropyPool
Sourcepub fn add_source(&mut self, source: Box<dyn EntropySource>, weight: f64)
pub fn add_source(&mut self, source: Box<dyn EntropySource>, weight: f64)
Register an entropy source.
Sourcepub fn source_count(&self) -> usize
pub fn source_count(&self) -> usize
Number of registered sources.
Sourcepub fn collect_all(&self) -> usize
pub fn collect_all(&self) -> usize
Collect entropy from every registered source (serial). Collect entropy from every registered source in parallel with per-source timeout (10s default). Sources that exceed the timeout are skipped.
Sourcepub fn collect_all_parallel(&self, timeout_secs: f64) -> usize
pub fn collect_all_parallel(&self, timeout_secs: f64) -> usize
Collect entropy from all sources in parallel using threads.
Sourcepub fn collect_enabled(&self, enabled_names: &[String]) -> usize
pub fn collect_enabled(&self, enabled_names: &[String]) -> usize
Collect entropy only from sources whose names are in the given list. Uses parallel threads. Collects 1000 samples per source.
Sourcepub fn collect_enabled_n(
&self,
enabled_names: &[String],
n_samples: usize,
) -> usize
pub fn collect_enabled_n( &self, enabled_names: &[String], n_samples: usize, ) -> usize
Collect n_samples of entropy from sources whose names are in the list.
Smaller n_samples values are faster — use this for interactive/TUI contexts.
Sourcepub fn get_raw_bytes(&self, n_bytes: usize) -> Vec<u8> ⓘ
pub fn get_raw_bytes(&self, n_bytes: usize) -> Vec<u8> ⓘ
Return n_bytes of raw, unconditioned entropy (XOR-combined only).
No SHA-256, no DRBG, no whitening. Preserves the raw hardware noise signal for researchers studying actual device entropy characteristics.
Sourcepub fn get_random_bytes(&self, n_bytes: usize) -> Vec<u8> ⓘ
pub fn get_random_bytes(&self, n_bytes: usize) -> Vec<u8> ⓘ
Return n_bytes of conditioned random output.
Sourcepub fn get_bytes(&self, n_bytes: usize, mode: ConditioningMode) -> Vec<u8> ⓘ
pub fn get_bytes(&self, n_bytes: usize, mode: ConditioningMode) -> Vec<u8> ⓘ
Return n_bytes of entropy with the specified conditioning mode.
Raw: XOR-combined source bytes, no whiteningVonNeumann: debiased but structure-preservingSha256: full cryptographic conditioning (default)
Sourcepub fn health_report(&self) -> HealthReport
pub fn health_report(&self) -> HealthReport
Health report as structured data.
Sourcepub fn print_health(&self)
pub fn print_health(&self)
Pretty-print health report.
Sourcepub fn source_infos(&self) -> Vec<SourceInfoSnapshot>
pub fn source_infos(&self) -> Vec<SourceInfoSnapshot>
Get source info for each registered source.