Expand description
Centralized entropy conditioning module.
ALL post-processing of raw entropy lives here — no conditioning code should exist in individual source implementations. Sources produce raw bytes; this module is the single, auditable gateway for any transformation.
§Architecture
Source → Raw Bytes → Conditioning Layer (this module) → Output§Conditioning Modes
- Raw: No processing. XOR-combined bytes pass through unchanged. Preserves the actual hardware noise signal for research.
- VonNeumann: Debias only. Removes first-order bias without destroying the noise structure. Output is shorter than input (~25% yield).
- Sha256: Full SHA-256 conditioning with counter and timestamp mixing. Produces cryptographically strong output but destroys the raw signal.
Most QRNG APIs (ANU, Outshift/Cisco) apply DRBG post-processing that makes
output indistinguishable from PRNG. The Raw mode here is what makes
openentropy useful for researchers studying actual hardware noise.
Structs§
- MinEntropy
Report - Min-entropy analysis report with individual estimator results.
- Quality
Report
Enums§
- Conditioning
Mode - Conditioning mode for entropy output.
Functions§
- collision_
estimate - Collision estimator (NIST-inspired diagnostic).
- compression_
estimate - Compression estimator (NIST-inspired diagnostic).
- condition
- Apply the specified conditioning mode to raw entropy bytes.
- grade_
min_ entropy - Grade a source based on its min-entropy (H∞) value.
- markov_
estimate - Markov estimator (NIST-inspired diagnostic).
- mcv_
estimate - Most Common Value (MCV) estimator (NIST-inspired 800-90B 6.3.1 style). Estimates min-entropy with upper bound on p_max using confidence interval. Returns (min_entropy_bits_per_sample, p_max_upper_bound).
- min_
entropy - Min-entropy estimate: H∞ = -log2(max probability). More conservative than Shannon — reflects worst-case guessing probability. Returns bits per sample (0.0 to 8.0 for byte-valued data).
- min_
entropy_ estimate - Min-entropy estimate with diagnostic side metrics.
- quick_
autocorrelation_ lag1 - Quick lag-1 autocorrelation for a byte slice.
- quick_
min_ entropy - Quick min-entropy estimate using only the MCV estimator (NIST SP 800-90B 6.3.1).
- quick_
quality - Quick quality assessment.
- quick_
shannon - Quick Shannon entropy in bits/byte for a byte slice.
- sha256_
condition - SHA-256 condition with explicit state, sample, counter, and extra data. Returns (new_state, 32-byte output).
- sha256_
condition_ bytes - SHA-256 chained conditioning: stretches or compresses raw bytes to exactly
n_outputbytes using counter-mode hashing. - t_
tuple_ estimate - t-Tuple estimator (NIST-inspired diagnostic). Estimates entropy from most frequent t-length tuple. Returns estimated min-entropy bits per sample.
- von_
neumann_ debias - Von Neumann debiasing: extract unbiased bits from a biased stream.
- xor_
fold - XOR-fold: reduce data by XORing the first half with the second half. If the input has an odd length, the trailing byte is XORed into the last output byte to avoid silently discarding entropy.