I am already using the 2 they suggest :

https://github.com/usnistgov/SP800-90B_EntropyAssessment https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90B.pdf

but, here is where I run into issues, I have a a file with 1,000,000 bits, what's the right format for the input? they don't state that, should it be a python tuple, or a list, or a just 1s and 0s continuously.

I ran the iid test, and got a score for H_original, but there are no guidelines that I can understand that state exactly how good or bad that is.

I have worked with Dieharder before and it was much clearer, they had a list of tests and gave a clear indication of whether you passed or failed the tests.

Help me out here, trying to test how random a bunch of 1s and 0s are.

  • $\begingroup$ CAUTION: Dieharder, SP800-90B_EntropyAssessment etc.. can demonstrate beyond doubt that a sequence of bits is not uniformly random. But they are essentially useless to assess that a sequence of bits is suitable for cryptographic use, unless these bits are from a source of well-defined nature and NOT post-conditioned cryptographically. Many publications on cryptography nevertheless use results of such tests on the output of a cryptographic construction as an argument for the security of that construction. Such a deep flaw often causes rejection by serious publications on cryptography. $\endgroup$
    – fgrieu
    Sep 28, 2022 at 9:20
  • $\begingroup$ @fgrieu Itsy bitsy thing though. 90B is not a randomness test. It's a min.entropy measurement. So there's no pass or fail. ANY sequence of bits of ANY distribution is acceptable to those tests. It just spits out a Min. entropy value. (Which is naff for the ea_non_iid test.) $\endgroup$
    – Paul Uszak
    Sep 28, 2022 at 12:50
  • $\begingroup$ @fgrieu what do you recommend I look into to actually assess the quality of randomness? If those tests are good enough, what should I be looking into? also, where can I read more about "post-conditioned cryptography", I don't know what that is. $\endgroup$ Sep 28, 2022 at 16:52
  • $\begingroup$ To actually assess that randomness is of crypto quality, there is no substitute to analyzing how it is generated. Again, no automated tool applied to the generated randomness can do this; they can only detect some of the worst kinds of cryptographic weaknesses. It is easy to make a simple PRNG that passes all tests, yet is insecure. For post-conditioning, see SP800-90A. For context about use, see this. $\endgroup$
    – fgrieu
    Sep 28, 2022 at 17:34

1 Answer 1


It's not too difficult:-

  • Format has to be a pure binary file. No Python nothin'.
  • Any other formats will produce a valid $H_{\infty}$ estimate, but will have been treated as pure binary. So e.g. 32 bit ASCII integers followed by a carriage return will be interpreted in the strictest binary sense, symbol by symbol.
  • Expect $H_{\infty} \approx$ 7.9 bits/byte to use the samples directly for encryption.
  • The samples must have 256 unique symbols in order to use them directly for encryption.
  • $H_{\infty}$ and the number of unique symbols can be anything if you're going to use a downstream randomness extractor.
  • Add the -v argument for something to watch while you wait (and show the tests).
  • Failed tests have a star next to them.
  • Be mindful of fgrieu's comment to you.

Good luck.

  • $\begingroup$ okay, this is what I understood 1. It should preferably be a binary file. 2. 7,9 out of 8 is an excellent score 3. I need the generator to generate 256 unique symbols 4. I will use -v and keep fgrieu's comment in mind. How do you know all this? Is there some guide I could follow that will guide me through running this. I am quite new to this space as you might have guessed from the question. $\endgroup$ Sep 28, 2022 at 16:47
  • $\begingroup$ @VardhanMahajan Well the documents you've mentioned are about it. $\endgroup$
    – Paul Uszak
    Sep 28, 2022 at 21:02
  • $\begingroup$ Further to that you're relying on experience :-) Although please don't overthink 90B. It's just measuring a specific quantity. You'll understand when running with the -v option. There are real world examples here illustrating how 90B fits into a design. $\endgroup$
    – Paul Uszak
    Sep 28, 2022 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.