Check for invalid results for all tests that flag error
Closed this issue · 0 comments
joshuaehill commented
Some (though not all) of the estimators can return values less than 0 to indicate an error. This indicates that the estimator was unable to run, and such results should be ignored.
The line
Should instead be
if(bin_lrs_res >= 0.0) h_bitstring = min(bin_lrs_res, h_bitstring);
Similarly the lines in
SP800-90B_EntropyAssessment/cpp/non_iid_main.cpp
Lines 341 to 350 in 71160ce
should instead be
// Section 6.3.6 - Estimate entropy with LRS Test
if ((((data.alph_size > 2) || !initial_entropy)) && (bin_lrs_res >= 0.0)) {
if (verbose == 1) printf("\tLRS Test Estimate (bit string) = %f / 1 bit(s)\n", bin_lrs_res);
H_bitstring = min(bin_lrs_res, H_bitstring);
}
if (initial_entropy && (lrs_res >= 0.0)) {
if (verbose == 1) printf("\tLRS Test Estimate = %f / %d bit(s)\n", lrs_res, data.word_size);
H_original = min(lrs_res, H_original);
}