Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

stEntropyEstimators

Delphi port of the NIST SP 800-90B section 6.3 non-IID min-entropy
  estimators, from the reference implementation
  (github.com/usnistgov/SP800-90B_EntropyAssessment, VERSION 1.1.8).

  WHY THIS EXISTS: the reference is C++ and needs bz2/divsufsort/openssl/gmp/
  mpfr/jsoncpp. A Delphi consumer of this library cannot be assumed to have a
  C++ toolchain, so the assessment has to be runnable in-tree, on the target.

  EVERY estimator here is verified against `ea_non_iid` output on the same data:
  each function (and its intermediate values, not just H) is diffed against
  recorded reference figures.
  An estimator that has not been diffed against the oracle does not belong in
  this unit: a wrong constant yields a confident, wrong entropy claim, which is
  worse than no estimate.

  WHICH ESTIMATOR APPLIES TO WHAT (non_iid_main.cpp):
    6.3.1 MCV, 6.3.5 t-Tuple, 6.3.6 LRS, 6.3.7 MultiMCW, 6.3.8 Lag,
    6.3.9 MultiMMC, 6.3.10 LZ78Y  -> run on the symbols AND on the bitstring
    6.3.2 Collision, 6.3.3 Markov, 6.3.4 Compression
                                  -> literal ONLY when alph_size = 2; for 8-bit
                                     data they run on the BITSTRING only.
  Rollup:  H = min( word_size, H_bitstring*word_size (if alph_size > 2),
                    H_original )

Feature notes: DRBG and entropy source (SP 800-90) notes

Classes, interfaces and records

classtTupleCounts

Suffix array + LCP over the sample string; t-Tuple and LRS both need the counts of repeated i-tuples, and the reference derives both from one suffix array (SAalgs). Building it twice would be wasteful and could drift.

constructor Create(const aSamples: TBytes); function MaxTupleCount(aI: Integer): Int64;
Q[i] = occurrences of the most common i-tuple; only tuples that fit entirely inside the string are counted.
function CollidingPairs(aI: Integer): Int64;
S[i] = sum over distinct i-tuples w of C(count(w),2) = colliding pairs.
function LongestRepeatedSubstring: Integer;
v = length of the longest repeated substring.
property N: Integer read fN;

recordtAssessment

A full section-3.1.3 initial-entropy assessment of one dataset: every estimator on the literal (word) data and on the per-sample bitstring, plus the rollup H = min(H_original, word_size * H_bitstring). LitH/BitH entries are -1.0 where an estimator did not run (not applicable to the pass, or the dataset was too small).

WordSize : Integer; AlphSize : Integer; LitH : array [tEstimatorId] of Double; BitH : array [tEstimatorId] of Double; HOriginal : Double;
min over the literal estimators that ran
HBitstring : Double;
min over the 10 bitstring estimators, or -1 if binary input
Assessed : Double;
the reported min-entropy per word
BindingId : tEstimatorId; BindingBit : Boolean;
True if the binding estimator was in the bitstring pass

Types (enumerations, sets, aliases)

enumtEstimatorId

The ten SP 800-90B section 6.3 non-IID estimators, in reference order.

  tEstimatorId = (esMcv, esCollision, esMarkov, esCompression, esTTuple,
                  esLrs, esMultiMcw, esLag, esMultiMmc, esLz78y);

Routines