Skip to main content

Module conditioning

Module conditioning 

Source
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§

MinEntropyReport
Min-entropy analysis report with individual estimator results.
QualityReport

Enums§

ConditioningMode
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_output bytes 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.