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
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;
function CollidingPairs(aI: Integer): Int64;
function LongestRepeatedSubstring: Integer;
property N: Integer read fN;
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;
HBitstring : Double;
Assessed : Double;
BindingId : tEstimatorId;
BindingBit : Boolean;
The ten SP 800-90B section 6.3 non-IID estimators, in reference order.