CH

October 21, 2017

FUCKGOATS testing

Filed under: Uncategorized — Benjamin Vulpes @ 11:15 p.m.

I got my FUCKGOATS some time ago; it is a hardware "true random number generator" that Stanislav (aka asciilifeform) designed and built to be as auditable and user-moddable as is sensibly possible; a marvelous achievement in the era of unmoddable and unfixable boxes.

Because I don't know much about how Linux works, I compiled my primary workstation kernel with as few additional options as I could figure out how to, mostly so that when I did need a thing, I could explicitly rebuild my system with the new stuff included, and learn a little more about how Linux works in the process. When I (finally) sat down to test my new TRNG before putting it to use (there was a move, and then a family catastrophe took up a fair amount of my spare cycles), I discovered that I'd built my system without the USB/serial drivers; trinque told me which to install (and now I realize that dmesg needs a place on the conveyor belt of dark Linux corners to study in more detail).

For posterity, search in the kernel's ncurses menuconfig for 2303. Nota benne: don't use the 2303x driver, you'll get shit results.

The unit behaved as follows:

With both hardware RNG modules plugged in, the unit puts out a steady 7.13-7.16 KiB/s of data. The SAD lamp flickers in this mode.

After removing a single hardware RNG module, the SAD lamp flickers at what appears to the eye a stable frequency (what I assume to be the "approximately half duty cycle" Stan mentions in the bundled documentation), and the data output rate drops to the 3.2-3.92 KiB/s range.

After removing the second hardware RNG module, the SAD lamp goes full-red, and the data output rate drops to zero B/s.

Reconnection of each hardware RNG module results in a return to the single- and then double- RNG regimes described above.

I collected a 1.2 Gb sample, at an overall speed of 7.3 kB/s.

Test:

$ ent fg.bin
Entropy = 8.000000 bits per byte.

Optimum compression would reduce the size
of this 1279772160 byte file by 0 percent.

Chi square distribution for 1279772160 samples is 235.13, and randomly
would exceed this value 80.89 percent of the times.

Arithmetic mean value of data bytes is 127.4982 (127.5 = random).
Monte Carlo value for Pi is 3.141814562 (error 0.01 percent).
Serial correlation coefficient is 0.000026 (totally uncorrelated = 0.0).

 $ dieharder -a -g 201 -f fg.bin
#=============================================================================#
#            dieharder version 3.31.1 Copyright 2003 Robert G. Brown          #
#=============================================================================#
   rng_name    |           filename             |rands/second|
 file_input_raw|                          fg.bin|  5.40e+07  |

#=============================================================================#
        test_name   |ntup| tsamples |psamples|  p-value |Assessment
#=============================================================================#
   diehard_birthdays|   0|       100|     100|0.98666530|  PASSED
      diehard_operm5|   0|   1000000|     100|0.67035484|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.88020420|  PASSED
    diehard_rank_6x8|   0|    100000|     100|0.76763346|  PASSED
# The file file_input_raw was rewound 1 times
   diehard_bitstream|   0|   2097152|     100|0.96300050|  PASSED
# The file file_input_raw was rewound 1 times
        diehard_opso|   0|   2097152|     100|0.53955310|  PASSED
# The file file_input_raw was rewound 2 times
        diehard_oqso|   0|   2097152|     100|0.88715354|  PASSED
# The file file_input_raw was rewound 2 times
         diehard_dna|   0|   2097152|     100|0.33133522|  PASSED
# The file file_input_raw was rewound 2 times
diehard_count_1s_str|   0|    256000|     100|0.56016452|  PASSED
# The file file_input_raw was rewound 2 times
diehard_count_1s_byt|   0|    256000|     100|0.96678021|  PASSED
# The file file_input_raw was rewound 2 times
 diehard_parking_lot|   0|     12000|     100|0.43795973|  PASSED
# The file file_input_raw was rewound 2 times
    diehard_2dsphere|   2|      8000|     100|0.85593867|  PASSED
# The file file_input_raw was rewound 2 times
    diehard_3dsphere|   3|      4000|     100|0.66806207|  PASSED
# The file file_input_raw was rewound 3 times
     diehard_squeeze|   0|    100000|     100|0.05050380|  PASSED
# The file file_input_raw was rewound 3 times
        diehard_sums|   0|       100|     100|0.65876356|  PASSED
# The file file_input_raw was rewound 3 times
        diehard_runs|   0|    100000|     100|0.43188959|  PASSED
        diehard_runs|   0|    100000|     100|0.24250750|  PASSED
# The file file_input_raw was rewound 3 times
       diehard_craps|   0|    200000|     100|0.03410948|  PASSED
       diehard_craps|   0|    200000|     100|0.94420710|  PASSED
# The file file_input_raw was rewound 10 times
 marsaglia_tsang_gcd|   0|  10000000|     100|0.00002160|   WEAK
 marsaglia_tsang_gcd|   0|  10000000|     100|0.00045187|   WEAK
# The file file_input_raw was rewound 10 times
         sts_monobit|   1|    100000|     100|0.96121113|  PASSED
# The file file_input_raw was rewound 10 times
            sts_runs|   2|    100000|     100|0.74150968|  PASSED
# The file file_input_raw was rewound 10 times
          sts_serial|   1|    100000|     100|0.67751940|  PASSED
          sts_serial|   2|    100000|     100|0.56026407|  PASSED
          sts_serial|   3|    100000|     100|0.94752018|  PASSED
          sts_serial|   3|    100000|     100|0.90140764|  PASSED
          sts_serial|   4|    100000|     100|0.99571612|   WEAK
          sts_serial|   4|    100000|     100|0.94527467|  PASSED
          sts_serial|   5|    100000|     100|0.54417586|  PASSED
          sts_serial|   5|    100000|     100|0.10405825|  PASSED
          sts_serial|   6|    100000|     100|0.23627142|  PASSED
          sts_serial|   6|    100000|     100|0.42339753|  PASSED
          sts_serial|   7|    100000|     100|0.62474027|  PASSED
          sts_serial|   7|    100000|     100|0.57962617|  PASSED
          sts_serial|   8|    100000|     100|0.84411400|  PASSED
          sts_serial|   8|    100000|     100|0.93098818|  PASSED
          sts_serial|   9|    100000|     100|0.71146585|  PASSED
          sts_serial|   9|    100000|     100|0.67605330|  PASSED
          sts_serial|  10|    100000|     100|0.40270963|  PASSED
          sts_serial|  10|    100000|     100|0.14170328|  PASSED
          sts_serial|  11|    100000|     100|0.11972194|  PASSED
          sts_serial|  11|    100000|     100|0.74530096|  PASSED
          sts_serial|  12|    100000|     100|0.03178283|  PASSED
          sts_serial|  12|    100000|     100|0.05210058|  PASSED
          sts_serial|  13|    100000|     100|0.20574640|  PASSED
          sts_serial|  13|    100000|     100|0.55628358|  PASSED
          sts_serial|  14|    100000|     100|0.30391287|  PASSED
          sts_serial|  14|    100000|     100|0.89964884|  PASSED
          sts_serial|  15|    100000|     100|0.85923599|  PASSED
          sts_serial|  15|    100000|     100|0.88102197|  PASSED
          sts_serial|  16|    100000|     100|0.18312975|  PASSED
          sts_serial|  16|    100000|     100|0.14455349|  PASSED
# The file file_input_raw was rewound 10 times
         rgb_bitdist|   1|    100000|     100|0.68703029|  PASSED
# The file file_input_raw was rewound 10 times
         rgb_bitdist|   2|    100000|     100|0.91462553|  PASSED
# The file file_input_raw was rewound 10 times
         rgb_bitdist|   3|    100000|     100|0.35857758|  PASSED
# The file file_input_raw was rewound 10 times
         rgb_bitdist|   4|    100000|     100|0.93276585|  PASSED
# The file file_input_raw was rewound 11 times
         rgb_bitdist|   5|    100000|     100|0.65204925|  PASSED
# The file file_input_raw was rewound 11 times
         rgb_bitdist|   6|    100000|     100|0.93582682|  PASSED
# The file file_input_raw was rewound 12 times
         rgb_bitdist|   7|    100000|     100|0.98695371|  PASSED
# The file file_input_raw was rewound 12 times
         rgb_bitdist|   8|    100000|     100|0.89775049|  PASSED
# The file file_input_raw was rewound 13 times
         rgb_bitdist|   9|    100000|     100|0.62752096|  PASSED
# The file file_input_raw was rewound 13 times
         rgb_bitdist|  10|    100000|     100|0.16794657|  PASSED
# The file file_input_raw was rewound 14 times
         rgb_bitdist|  11|    100000|     100|0.96934025|  PASSED
# The file file_input_raw was rewound 15 times
         rgb_bitdist|  12|    100000|     100|0.68765937|  PASSED
# The file file_input_raw was rewound 15 times
rgb_minimum_distance|   2|     10000|    1000|0.23177467|  PASSED
# The file file_input_raw was rewound 15 times
rgb_minimum_distance|   3|     10000|    1000|0.28749566|  PASSED
# The file file_input_raw was rewound 15 times
rgb_minimum_distance|   4|     10000|    1000|0.08484850|  PASSED
# The file file_input_raw was rewound 15 times
rgb_minimum_distance|   5|     10000|    1000|0.33804203|  PASSED
# The file file_input_raw was rewound 15 times
    rgb_permutations|   2|    100000|     100|0.52644697|  PASSED
# The file file_input_raw was rewound 15 times
    rgb_permutations|   3|    100000|     100|0.23480976|  PASSED
# The file file_input_raw was rewound 15 times
    rgb_permutations|   4|    100000|     100|0.77301813|  PASSED
# The file file_input_raw was rewound 16 times
    rgb_permutations|   5|    100000|     100|0.14308387|  PASSED
# The file file_input_raw was rewound 16 times
      rgb_lagged_sum|   0|   1000000|     100|0.95865965|  PASSED
# The file file_input_raw was rewound 16 times
      rgb_lagged_sum|   1|   1000000|     100|0.78736179|  PASSED
# The file file_input_raw was rewound 17 times
      rgb_lagged_sum|   2|   1000000|     100|0.73485016|  PASSED
# The file file_input_raw was rewound 19 times
      rgb_lagged_sum|   3|   1000000|     100|0.88323233|  PASSED
# The file file_input_raw was rewound 20 times
      rgb_lagged_sum|   4|   1000000|     100|0.30712699|  PASSED
# The file file_input_raw was rewound 22 times
      rgb_lagged_sum|   5|   1000000|     100|0.73801023|  PASSED
# The file file_input_raw was rewound 24 times
      rgb_lagged_sum|   6|   1000000|     100|0.49668545|  PASSED
# The file file_input_raw was rewound 27 times
      rgb_lagged_sum|   7|   1000000|     100|0.15066070|  PASSED
# The file file_input_raw was rewound 30 times
      rgb_lagged_sum|   8|   1000000|     100|0.51924357|  PASSED
# The file file_input_raw was rewound 33 times
      rgb_lagged_sum|   9|   1000000|     100|0.09273091|  PASSED
# The file file_input_raw was rewound 36 times
      rgb_lagged_sum|  10|   1000000|     100|0.47972387|  PASSED
# The file file_input_raw was rewound 40 times
      rgb_lagged_sum|  11|   1000000|     100|0.00161297|   WEAK
# The file file_input_raw was rewound 44 times
      rgb_lagged_sum|  12|   1000000|     100|0.31070382|  PASSED
# The file file_input_raw was rewound 48 times
      rgb_lagged_sum|  13|   1000000|     100|0.35468814|  PASSED
# The file file_input_raw was rewound 53 times
      rgb_lagged_sum|  14|   1000000|     100|0.10687236|  PASSED
# The file file_input_raw was rewound 58 times
      rgb_lagged_sum|  15|   1000000|     100|0.00016418|   WEAK
# The file file_input_raw was rewound 63 times
      rgb_lagged_sum|  16|   1000000|     100|0.98918038|  PASSED
# The file file_input_raw was rewound 69 times
      rgb_lagged_sum|  17|   1000000|     100|0.05383104|  PASSED
# The file file_input_raw was rewound 75 times
      rgb_lagged_sum|  18|   1000000|     100|0.24155324|  PASSED
# The file file_input_raw was rewound 81 times
      rgb_lagged_sum|  19|   1000000|     100|0.01044452|  PASSED
# The file file_input_raw was rewound 88 times
      rgb_lagged_sum|  20|   1000000|     100|0.38143360|  PASSED
# The file file_input_raw was rewound 95 times
      rgb_lagged_sum|  21|   1000000|     100|0.96866648|  PASSED
# The file file_input_raw was rewound 102 times
      rgb_lagged_sum|  22|   1000000|     100|0.99681586|   WEAK
# The file file_input_raw was rewound 109 times
      rgb_lagged_sum|  23|   1000000|     100|0.00164146|   WEAK
# The file file_input_raw was rewound 117 times
      rgb_lagged_sum|  24|   1000000|     100|0.38844251|  PASSED
# The file file_input_raw was rewound 125 times
      rgb_lagged_sum|  25|   1000000|     100|0.82034726|  PASSED
# The file file_input_raw was rewound 134 times
      rgb_lagged_sum|  26|   1000000|     100|0.76768179|  PASSED
# The file file_input_raw was rewound 142 times
      rgb_lagged_sum|  27|   1000000|     100|0.69530908|  PASSED
# The file file_input_raw was rewound 151 times
      rgb_lagged_sum|  28|   1000000|     100|0.76985542|  PASSED
# The file file_input_raw was rewound 161 times
      rgb_lagged_sum|  29|   1000000|     100|0.00411003|   WEAK
# The file file_input_raw was rewound 171 times
      rgb_lagged_sum|  30|   1000000|     100|0.43948397|  PASSED
# The file file_input_raw was rewound 181 times
      rgb_lagged_sum|  31|   1000000|     100|0.01413940|  PASSED
# The file file_input_raw was rewound 191 times
      rgb_lagged_sum|  32|   1000000|     100|0.75094742|  PASSED
# The file file_input_raw was rewound 191 times
     rgb_kstest_test|   0|     10000|    1000|0.09692339|  PASSED
# The file file_input_raw was rewound 191 times
     dab_bytedistrib|   0|  51200000|       1|0.08678343|  PASSED
# The file file_input_raw was rewound 191 times
             dab_dct| 256|     50000|       1|0.92268099|  PASSED
Preparing to run test 207.  ntuple = 0
# The file file_input_raw was rewound 192 times
        dab_filltree|  32|  15000000|       1|0.58337872|  PASSED
        dab_filltree|  32|  15000000|       1|0.89777257|  PASSED
Preparing to run test 208.  ntuple = 0
# The file file_input_raw was rewound 192 times
       dab_filltree2|   0|   5000000|       1|0.10809719|  PASSED
       dab_filltree2|   1|   5000000|       1|0.30363556|  PASSED
Preparing to run test 209.  ntuple = 0
# The file file_input_raw was rewound 192 times
        dab_monobit2|  12|  65000000|       1|0.20144483|  PASSED

Kudos to Stan on shipping a building block of the future. With a few of these in your arsenal, you can start building serious walls between you and the megastates who endeavour to break cryptography with snake-oil software-based random number generators.

---