usnistgov / SP800-90B_EntropyAssessment

The SP800-90B_EntropyAssessment C++package implements the min-entropy assessment methods included in Special Publication 800-90B.
195 stars 88 forks source link

ea_restart core dumps on k_max <= k' #195

Open mmccarl opened 2 years ago

mmccarl commented 2 years ago

i specified bitspersample = 4, alphabetsize = 16 and hminestimate = 3.2, but input file has only 3 bits per sample (with the 5 high order bits all zeros). When ea_restart was run, it said that the symbols appear to be narrower than described then it aborted with a core dump because Assertion 'k_max <= k' failed. No json output is produced in this scenario.

the program should at least produced a json output containing an error message.

joshuaehill commented 2 years ago

Your estimate suggests that the sample used to produce $H_\text{original}$ actually had 4 bits per sample. You then have a fairly large restart sample where this is not so, so this is an instance where the restart testing is expected to reduce your entropy claim.

In practice, the restart testing is going to reduce the estimate to less than 3 bits: both $H{c}$ and $H{r}$ are going to be less than 3. As such, you could reduce your estimate to 3 and the result will be the same (or better) as if that assert was removed. From a 90B perspective, this would be done by reducing your $H_{\text{submitter}}$ value.