Random Numbers
This will run the FIPS random test suite. Useful for ensuring your random or pseudo-random number generator is good.
Fedora: yum install rng-tools
For example:
$ openssl rand 2500 | rngtest
rngtest 3
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
rngtest: starting FIPS tests...
rngtest: entropy source drained
rngtest: bits received from input: 20000
rngtest: FIPS 140-2 successes: 0
rngtest: FIPS 140-2 failures: 0
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 0
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=0.000; avg=0.000; max=0.000)bits/s
rngtest: FIPS tests speed: (min=0.000; avg=0.000; max=0.000)bits/s
rngtest: Program run time: 9601 microseconds
Or, using my opensc-random util:
$ opensc-random 2500 | rngtest
rngtest 3
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
rngtest: starting FIPS tests...
rngtest: entropy source drained
rngtest: bits received from input: 20000
rngtest: FIPS 140-2 successes: 0
rngtest: FIPS 140-2 failures: 0
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 0
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=0.000; avg=0.000; max=0.000)bits/s
rngtest: FIPS tests speed: (min=0.000; avg=0.000; max=0.000)bits/s
rngtest: Program run time: 7798403 microseconds
Note the difference in run time.
The definition of the tests can be found here: http://csrc.nist.gov/publications/fips/fips1401.htm. See section 4.11.
Slow, via Smart Card: https://github.com/strongrandom/opensc-random.
Faster, via dongle: http://www.entropykey.co.uk/tech/ (these have been on a long wait list for quite some time).
Ridiculous, via quantum mechanics: http://qrng.anu.edu.au/index.php and http://lewk.org/quantumrandom.html.
TODO: The RaspberryPI has a hardware random generator.
https://github.com/MaartenBaert/xormix
Better random library, but will NOT pass the FIPS test suite: