Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Looking for guidance/references with/about calculations:

I am designing a widget that creates N-bit binary sequences. My customers target spec for the sequence's minimum entropy is X bits/bit. I plan to count occurrences of run lengths of 1,2,..R in M of the N-bit output strings and compare to min and max thresholds Tmin1,Tmin2,..TminR, and Tmax1,Tmax2,..TmaxR respectively in order to pass/fail each widget on the factory floor.

I am looking for the math to help me determine the parameters M and R as well as the thresholds [Tmin] and [Tmax] in order to have a given level of confidence in my result.

Apologies if I butchered the notation. I am not a mathematician :)

Any tips greatly appreciated.

share|improve this question

closed as off-topic by D.W., DrLecter, poncho, e-sushi, archie Aug 3 '14 at 0:51

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on mathematics are off-topic unless they relate directly to cryptography. These questions can usually be asked on Mathematics Stack Exchange." – D.W., DrLecter, poncho, e-sushi, archie
If this question can be reworded to fit the rules in the help center, please edit the question.

This might interest you. It sounds like you want to estimate the entropy of the n-bin binary sequences and want to make sure you choose the parameters so that you have a given confidence level. This question might be better off on – mikeazo Aug 1 '14 at 18:31
Perhaps ENT ( might help you. One question, are you trying to check, if the bit sequence is sufficient random ? – Thor Aug 1 '14 at 19:14
Please, do not use simple tools like ENT as Thor commented, because such little thingies are far from complete and surely don’t check all the stuff you should check. If you really need a test-suite, simply take a look at this answer which provides a quick overview of the most prominent, well-vetted, and respected test suites. (Disclaimer: yes, that’s one of my answers…) – e-sushi Aug 1 '14 at 23:22
This question looks off-topic to me. The site is for questions about cryptography (see here); your question does not appear to fit the fall within the scope of the site. – D.W. Aug 2 '14 at 0:31

If the sequences are supposed to be perfectly random, you may want to take a look at e.g. the NIST statistical test suite. However, you should be aware that statistical tests don't prove or really even estimate entropy. They are just a sanity check that tells you whether the numbers look random. Non cryptographic PRNGs that are completely predictable can pass them.

If the numbers are meant to be used for cryptographic purposes, I would recommend approaching the problem from the opposite direction: start from real entropy from the OS, use known good primitives to build a CSPRNG. Better yet, find a library that already does all that.

share|improve this answer

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