[Cryptography] Dieharder & /dev/urandom

Michel Arboi michel.arboi at gmail.com
Tue May 14 09:17:56 EDT 2019


/dev/urandom is supposed to be as solid as /dev/random, except acute
paranoia: https://www.2uo.de/myths-about-urandom/

I played with Dieharder (evolution of the famous Diehard statistics tests)
There was a known bug wth 500 & 501 generators (/dev/random and /dev/urandom):
https://bugzilla.redhat.com/show_bug.cgi?id=803292
https://bugs.gentoo.org/677386

Once this bug is fixed, or by using a file filed with binary data
(dieharder -g 201 ...) I still find weaknesses with urandom
1. I get at least one WEAK result nearly every time I run "dieharder  -a -g 501"
2. These weaknesses do  not appear with /dev/random
3. The tests which failed are not always the same.

Failed tests I got so far:
rgb_lagged_sum (7 times), rgb_bitdist (6), sts_serial (3),
rgb_minimum_distance (2),
rgb_permutations (2),
diehard_crap, diehard_rank_32x32, rgb_kstest_test, sts_runs



Am I doing something wrong or is there a true weakness in /dev/urandom?

Example:

$ dieharder  -a -g 501
#=============================================================================#
#            dieharder version 3.31.1 Copyright 2003 Robert G.
Brown          #
#=============================================================================#
rng_name    |rands/second|   Seed   | /dev/urandom|  1.79e+07
|1200973343|
#=============================================================================#
test_name   |ntup| tsamples |psamples|  p-value |Assessment
#=============================================================================#
diehard_birthdays|   0|       100|     100|0.46753772|  PASSED
diehard_operm5|   0|   1000000|     100|0.84242621|  PASSED
diehard_rank_32x32|   0|     40000|     100|0.22126282|  PASSED [snip]
          sts_serial|  12|    100000|     100|0.59332179|  PASSED
          sts_serial|  12|    100000|     100|0.99723352|   WEAK   <---
          sts_serial|  13|    100000|     100|0.73984626|  PASSED
          sts_serial|  13|    100000|     100|0.75394894|  PASSED
          sts_serial|  14|    100000|     100|0.53569954|  PASSED
          sts_serial|  14|    100000|     100|0.84443587|  PASSED
          sts_serial|  15|    100000|     100|0.70062655|  PASSED
          sts_serial|  15|    100000|     100|0.86398789|  PASSED
          sts_serial|  16|    100000|     100|0.77044189|  PASSED
          sts_serial|  16|    100000|     100|0.40665896|  PASSED
         rgb_bitdist|   1|    100000|     100|0.23117788|  PASSED
         rgb_bitdist|   2|    100000|     100|0.72830922|  PASSED
         rgb_bitdist|   3|    100000|     100|0.96816091|  PASSED
         rgb_bitdist|   4|    100000|     100|0.58267893|  PASSED
         rgb_bitdist|   5|    100000|     100|0.42065873|  PASSED
         rgb_bitdist|   6|    100000|     100|0.71015893|  PASSED
         rgb_bitdist|   7|    100000|     100|0.99864266|   WEAK   <---
         rgb_bitdist|   8|    100000|     100|0.59789616|  PASSED
[snip]
$


More information about the cryptography mailing list