I just want to check whether the entropy supplied is good enough for key generation or not .

  • $\begingroup$ Flip a coin 256 times and echo hthtthththhhhhhhtht... > /dev/urandom before you run it. Then you'll be good to go as long as nobody set up a surveillance camera in your office pointed at your keyboard! $\endgroup$ – Squeamish Ossifrage Dec 22 '17 at 6:42
  • $\begingroup$ @SqueamishOssifrage What if he’s using a plain Windows install? What about keyloggers or similar spyware/malware? Also, what if he’s not located at any office? And what if he doesn’t have a coin at hand? ;) $\endgroup$ – e-sushi Dec 22 '17 at 7:35

You cannot really determine this from the random data itself. The problem is that the bits may be well distributed but not very random. Without knowing how the random bits are generated it is impossible to determine if the random data contains enough entropy, or indeed if that entropy was generated well.

You can of course start by examining the random generator itself, and how it is seeded. Then you could generate a lot of data and run it through some kind of testing framework, e.g. the FIPS or German BSI defined testing suites. This could give an indication that the RNG itself is at least not behaving badly.

Within your application there is not much you can do. The only tests that could make some sense is to make sure that at least the zero and ones are distributed OK and that the RNG doesn't repeat over two calls (i.e. retrieve data, disconnect, repeat).

And obviously you should make sure that you're using the right algorithm and system to start with (e.g. Java has a strong RNG that may be explicitly selected. Obviously going for the (default) non-secure or badly seeded RNG such as the Mersenne Twister should be out of the question.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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