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_iid results are unstable #220

Closed sellicott closed 1 year ago

sellicott commented 1 year ago

Hi all, It seems like the permutation tests in the ea_iid program are pretty unstable. I can run the ea_iid on the same data file and come back with different results. Some of these results are unstable enough that it can change a passing result to a failing result on the same data file. For reference, the data I am running the tests on is composed of 1,000,000 8-bit samples per SP800-90B guidelines.

Background: I have been using the ea_iid program to test some raw data. Since I have a significant amount of data to go through, I wanted to script the test process in order to look at a summarized report. A few of the data files failed the tests, so I went back to look at them in greater detail. It so happened that when I ran ea_iid again directly, the tests passed. This made me very suspicious, so I ran a few more times logging the result each time. It seems like the results are usually relatively stable (within 1-2 counts), but every now and then a statistic will be significantly different from the other runs.

I presume the instability is due to using the Fisher-Yates shuffle algorithm, which is by it's nature unstable. It just seems odd that it's this variable. Here is my interpretation of the problem. The dataset I'm using is borderline on one of the permutation tests (over a set of 20 tests, the median was 9996); however, occasionally the Fisher-Yates shuffle smiles on the data and let's it pass.

Questions:

joshuaehill commented 1 year ago

All that said, the hard part of going through the IID path is producing a technical argument that you expect the system to be IID. Most noise sources are not.

sellicott commented 1 year ago

Thank you for the fast reply!

A couple follow on questions:

joshuaehill commented 1 year ago
sellicott commented 1 year ago

Thank you very much!