This question already has an answer here:

Let's say I am given to CSPRNGs: RNG1 and RNG2.
I want to select the best one of the two for cryptography.
How should I do it?
Any of the two RNGs can be initialized with a secret key during tests and any number of bytes can be generated from each RNG.
Are there statistical test suites already out there for this purpose?


marked as duplicate by otus, K.G., yyyyyyy, e-sushi Nov 6 '15 at 23:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ Any RNG approaching crypto quality (and many that are far from it) will pass any statistical test you can think of. You need expert cryptogaphers spending years analyzing your cipher (or simplified versions of it) to gain any confidence in it. $\endgroup$ – CodesInChaos Nov 6 '15 at 9:56
  • $\begingroup$ I did not ask for any proof. I asked if you can test them to choose the best one. $\endgroup$ – daruma Nov 6 '15 at 13:38
  • 1
    $\begingroup$ Are you given a CSPRNG as a physical box, or as a specification? That changes the entire perspective. $\endgroup$ – fgrieu Nov 6 '15 at 16:32
  • $\begingroup$ Yes, if you use an existing one implemented in software, I think it is convenient to consider it just as a black box: you can test it as much as you want but maybe you don't have access to a rigorous specification or you don't trust it implements it correctly/exactly. $\endgroup$ – daruma Nov 7 '15 at 8:47

The best one is the most reputable one. That is, the one which had been widely used, studied, and standardized. If both fall into that class, choose the one which uses more secure or larger-state primitives under the hood. Example: when comparing the NIST-standard Hash-DRBG using SHA-256 versus HMAC-DRBG with SHA-1, I would personally choose the first due to larger state and security margin of SHA-256.


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