Cryptosystems Journal animated header graphic

Using the RTL-SDR V3 (Software Defined Radio)
as an inexpensive USB Hardware RNG
(Random Number Generator) for Cryptography

I am reading Carl Laufer’s “The Hobbyists Guide to the RTL-SDR: Really Cheap Software Defined Radio, Fourth Edition”.

The RTL-SDR is an inexpensive (US$38) Software Defined Radio (SDR) which is based on the RTL2832U demodulator chip and an R860 RF tuner, equipped with a 1PPM temperature-compensated crystal oscillator (TCXO) to eliminate frequency drift, and an SMA antenna connector. When we say "Software Defined Radio" we are basically saying that the computer becomes a radio via its software.

There are a LOT of things that you can do with a SDR, here are Fifty Things you can do with a Software Defined Radio.

RTL-SDR V3 USB Dongle RTL-SDR telescopic antenna kit

The USB Dongle shown above is available on Amazon; you can also get its Dipole Antenna Kit, or save money and buy both USB dongle and Dipole Antenna kit together. For reference, the antenna kit includes both short telescopic antenna arms (5 cm to 23 cm) and long telescopic antenna arms (13 cm to 100 cm), in a quarter-wavelength configuration these cover from 75 MHz up to 1.4 GHz. Frequencies from 24 to 75 MHz can also be received, but these antennas are not ideal (too short).

On page 215 Laufer writes “Radio Noise received by a RTL-SDR USB dongle can be used as a high-quality entropy source in Linux, via a program named RTL-ENTROPY.”

If you are not familiar with the concept of ENTROPY in Information Theory, take a look at Wikipedia's ENTROPY page. Suffice it to say that Entropy is the absolute bedrock of cryptography; without an uncompromised, high-entropy source of randomness, there can not be secrecy. History has shown that attackers don't always need to break complex math—they can simply subvert the random number generators instead. Specifically, intelligence agencies covertly engineered backdoors into standards like Dual_EC_DRBG, proving that compromising the source of randomness can hollow out encryption from the inside.

The source of the entropy is environmental RF thermal noise and ambient VHF background electromagnetic radiation harvested via an RTL-SDR V3 and its attached antenna.

Laufer points to the RTL-ENTROPY repository at https://github.com/pwarren/rtl-entropy.

Even though the software is abandoned as of December 2020, we can still use the programs, and they still work. I setup and successfully ran this (September 2026) using an older desktop PC with Rocky Linux 9.

Here are two important sections from the GitHub web page:

Introduction to the repository:
rtl-entropy is software using rtl-sdr to turn your DVB-T dongle into a high quality entropy source. It samples atmospheric noise, does Von-Neumann debiasing, runs it through the FIPS 140-2 tests, then optionally (-e) does Kaminsky debiasing if it passes the FIPS tests, then writes to the output. It can be run as a Daemon which by default writes to a FIFO, which can be read by rngd to add entropy to the system pool.

If you're serious about the cryptographic security of your entropy source, you should probably short, or put a 75 Ohm load on the antenna port, and put the whole assembly in a shielded box. Then you're getting entropy from the thermal noise of the amplifiers which is much harder to interfere with than atmospheric radio. Both of these are analog entropy sources.
Cryptography Discussion

As mentioned above, capturing atmospheric radio is not terribly secure if someone can transmit over the bandwidth you're listening on; they could potentially influence the entropy you're getting and be able then to guess your private keys!

To combat this, there's an option (-e) to do Kaminsky debiasing, which will dramatically alter the output if the input differs slightly. What this debiasing step does is take the bits rejected from the von Neumann filter and create a SHA-512 hash from those bits, then encrypt the entropy from the von Neumann filter using the hash as the key.

This makes the output much harder for an attacker to guess; entropy output will differ unpredictably for the attacker as they have to know the quantization limits of your ADC to know which bits will be used where!


Tuning to 74 MHz

We set the RTL-SDR to listen to 74 MHz because 73.0 – 74.6 MHz is allocated solely to Radio Astronomy, and as such, is strictly receive-only. Transmitting at these frequencies is prohibited by law. Why this makes 74 MHz a goldmine for entropy: Because the FCC bans local transmitters, repeaters, and commercial broadcasts from operating in the 73–74.6 MHz bracket, you are tuning your RTL-SDR into a frequency range where ambient man-made noise is legally suppressed. See the NTIA chart at NTIA Frequency Allocations PDF to visualize this frequency range.

The British Astronomical Association has more information about this (and other) frequency ranges, and here are more details about what is found in this band:
rtl_entropy -f 74M > rtl_entropy_at_74M.bin
(use control-C to stop after enough data)

Sample raw hex output:

00112520: 70be cde5 c005 2136 fa09 2fc9 9651 6539  p.....!6../..Qe9
00112530: 43d6 c871 8f05 4dd7 baff 7252 b648 9cea  C..q..M...rR.H..
00112540: 8f93 bf8a 2d41 0a0f cbe0 d32a f312 b088  ....-A.....*....
00112550: dbe9 b824 2119 5b44 4e23 2358 17ba 8b82  ...$!.[DN##X....
00112560: 7d2d feb8 6461 830f 37eb 1a73 0afe 4d90  }-..da..7..s..M.
00112570: 546e 6f22 75e7 37f0 f18c bc0e 481c 9fed  Tno"u.7.....H...
00112580: b010 7159 b7d0 49de 9ea8 ac58 c594 c3d2  ..qY..I....X....
00112590: acc7 75f8 ef38 893d c68e dcbe df89 34e7  ..u..8.=......4.
001125a0: 7510 c852 0dc3 a98a 2e5a b3a1 2fbf 29b0  u..R.....Z../.).
001125b0: e16e fd0d f227 b78b 1885 5855 50c0 48a5  .n...'....XUP.H.
001125c0: a772 a280 7efa 71e3 ced9 2851 a7b9 9b8b  .r..~.q...(Q....
001125d0: a7fc 26c7 4b67 19fa 2059 a5e9 84d2 c09c  ..&.Kg.. Y......
001125e0: 3736 c555 a443 4f70 efc9 b5db 1343 c30d  76.U.COp.....C..
001125f0: 6d42 515b afc9 f561 908e c99c edcc 9960  mBQ[...a.......`
00112600: 6679 d593 f54a 520b 0bf9 2bb8 faca 8594  fy...JR...+.....
00112610: 1632 17ac b3cc 9033 1131 6a67 5471 b174  .2.....3.1jgTq.t
00112620: 28e0 e5be 5e1f e70d 7c25 642e ad67 9902  (...^...|%d..g..
00112630: 944c ab62 d069 950c c551 3ab1 023b e1a6  .L.b.i...Q:..;..
00112640: f01c ff18 7535 4af4 3425 5056 cc35 2d84  ....u5J.4%PV.5-.
00112650: cb0a 50c9 faff a8b2 060d 5442 cbd3 eead  ..P.......TB....
00112660: c51c ef59 0fc7 ba0b 2b0d 6e8c bf19 33d3  ...Y....+.n...3.
00112670: 94bd 698d 57a7 6d60 f389 8dc8 f261 0c9b  ..i.W.m`.....a..
00112680: 7a8d 1195 67ff 6b60 7861 5d44 31e3 f38e  z...g.k`xa]D1...
00112690: e4b6 d80e 7e45 0d7b 81a1 e16f a037 3e78  ....~E.{...o.7>x
001126a0: 2aba 8982 30ca 62ce 997e 6b09 7297 f229  *...0.b..~k.r..)
001126b0: 225d 16b8 3bcb b67e ee88 1980 216e 4904  "]..;..~....!nI.
001126c0: 92a8 4102 b523 bf7a ea17 1b4a 1baf dd16  ..A..#.z...J....
001126d0: 33fa 3ecc 5ea9 aa49 c556 e74f f9ff 9cca  3.>.^..I.V.O....
# ent rtl_entropy_at_74M.bin
Entropy = 7.999962 bits per byte.

The Dieharder battery of tests are the gold standard for verifying random numbers:

while true; do rtl_entropy -f 74M 2>/dev/null; done | dieharder -g 200 -a
#=============================================================================#
#            dieharder version 3.31.1 Copyright 2003 Robert G. Brown          #
#=============================================================================#
   rng_name    |rands/second|   Seed   |
stdin_input_raw|  1.00e+05  |3164539769|
#=============================================================================#
        test_name   |ntup| tsamples |psamples|  p-value |Assessment
#=============================================================================#
   diehard_birthdays|   0|       100|     100|0.09527490|  PASSED
      diehard_operm5|   0|   1000000|     100|0.81616947|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.99811831|   WEAK
    diehard_rank_6x8|   0|    100000|     100|0.55047898|  PASSED
   diehard_bitstream|   0|   2097152|     100|0.32325353|  PASSED
        diehard_opso|   0|   2097152|     100|0.72173408|  PASSED
        diehard_oqso|   0|   2097152|     100|0.62599391|  PASSED
         diehard_dna|   0|   2097152|     100|0.25163770|  PASSED
diehard_count_1s_str|   0|    256000|     100|0.06372343|  PASSED
diehard_count_1s_byt|   0|    256000|     100|0.47791424|  PASSED
 diehard_parking_lot|   0|     12000|     100|0.87273794|  PASSED
    diehard_2dsphere|   2|      8000|     100|0.05739763|  PASSED
    diehard_3dsphere|   3|      4000|     100|0.58856664|  PASSED
     diehard_squeeze|   0|    100000|     100|0.66483413|  PASSED
        diehard_sums|   0|       100|     100|0.45217348|  PASSED
        diehard_runs|   0|    100000|     100|0.13551395|  PASSED
        diehard_runs|   0|    100000|     100|0.82288398|  PASSED
       diehard_craps|   0|    200000|     100|0.76866648|  PASSED
       diehard_craps|   0|    200000|     100|0.18505021|  PASSED
 marsaglia_tsang_gcd|   0|  10000000|     100|0.06054545|  PASSED
 marsaglia_tsang_gcd|   0|  10000000|     100|0.15228948|  PASSED
         sts_monobit|   1|    100000|     100|0.45844978|  PASSED
            sts_runs|   2|    100000|     100|0.44106791|  PASSED
          sts_serial|   1|    100000|     100|0.92527782|  PASSED
          sts_serial|   2|    100000|     100|0.99571553|   WEAK
          sts_serial|   3|    100000|     100|0.49715418|  PASSED
          sts_serial|   3|    100000|     100|0.32896067|  PASSED
          sts_serial|   4|    100000|     100|0.62817798|  PASSED
          sts_serial|   4|    100000|     100|0.48828881|  PASSED
          sts_serial|   5|    100000|     100|0.73071020|  PASSED
          sts_serial|   5|    100000|     100|0.73965561|  PASSED
          sts_serial|   6|    100000|     100|0.97810479|  PASSED
          sts_serial|   6|    100000|     100|0.53064037|  PASSED
          sts_serial|   7|    100000|     100|0.94782660|  PASSED
          sts_serial|   7|    100000|     100|0.96699632|  PASSED
          sts_serial|   8|    100000|     100|0.82337840|  PASSED
          sts_serial|   8|    100000|     100|0.23654421|  PASSED
          sts_serial|   9|    100000|     100|0.58873137|  PASSED
          sts_serial|   9|    100000|     100|0.98263312|  PASSED
          sts_serial|  10|    100000|     100|0.39964527|  PASSED
          sts_serial|  10|    100000|     100|0.15749777|  PASSED
          sts_serial|  11|    100000|     100|0.99943901|   WEAK
          sts_serial|  11|    100000|     100|0.18588679|  PASSED
          sts_serial|  12|    100000|     100|0.93157856|  PASSED
          sts_serial|  12|    100000|     100|0.96725934|  PASSED
          sts_serial|  13|    100000|     100|0.98971492|  PASSED
          sts_serial|  13|    100000|     100|0.80377810|  PASSED
          sts_serial|  14|    100000|     100|0.21267117|  PASSED
          sts_serial|  14|    100000|     100|0.09975829|  PASSED
          sts_serial|  15|    100000|     100|0.11724656|  PASSED
          sts_serial|  15|    100000|     100|0.07957726|  PASSED
          sts_serial|  16|    100000|     100|0.05675221|  PASSED
          sts_serial|  16|    100000|     100|0.27144641|  PASSED
         rgb_bitdist|   1|    100000|     100|0.30886801|  PASSED
         rgb_bitdist|   2|    100000|     100|0.36637808|  PASSED
         rgb_bitdist|   3|    100000|     100|0.96653964|  PASSED
         rgb_bitdist|   4|    100000|     100|0.98320578|  PASSED
         rgb_bitdist|   5|    100000|     100|0.68213638|  PASSED
         rgb_bitdist|   6|    100000|     100|0.44830765|  PASSED
         rgb_bitdist|   7|    100000|     100|0.25840367|  PASSED
         rgb_bitdist|   8|    100000|     100|0.84349874|  PASSED
         rgb_bitdist|   9|    100000|     100|0.53469827|  PASSED
         rgb_bitdist|  10|    100000|     100|0.10317767|  PASSED
         rgb_bitdist|  11|    100000|     100|0.72209619|  PASSED
         rgb_bitdist|  12|    100000|     100|0.67120059|  PASSED
rgb_minimum_distance|   2|     10000|    1000|0.91647417|  PASSED
rgb_minimum_distance|   3|     10000|    1000|0.74127531|  PASSED
rgb_minimum_distance|   4|     10000|    1000|0.12275180|  PASSED
rgb_minimum_distance|   5|     10000|    1000|0.31166605|  PASSED
    rgb_permutations|   2|    100000|     100|0.84337368|  PASSED
    rgb_permutations|   3|    100000|     100|0.74678433|  PASSED
    rgb_permutations|   4|    100000|     100|0.23784802|  PASSED
    rgb_permutations|   5|    100000|     100|0.54166062|  PASSED
      rgb_lagged_sum|   0|   1000000|     100|0.19969957|  PASSED
      rgb_lagged_sum|   1|   1000000|     100|0.99633492|   WEAK
      rgb_lagged_sum|   2|   1000000|     100|0.03091649|  PASSED
      rgb_lagged_sum|   3|   1000000|     100|0.32574674|  PASSED
      rgb_lagged_sum|   4|   1000000|     100|0.74519422|  PASSED
      rgb_lagged_sum|   5|   1000000|     100|0.73340950|  PASSED
      rgb_lagged_sum|   6|   1000000|     100|0.54557492|  PASSED
      rgb_lagged_sum|   7|   1000000|     100|0.43511851|  PASSED
      rgb_lagged_sum|   8|   1000000|     100|0.20356326|  PASSED
      rgb_lagged_sum|   9|   1000000|     100|0.40048730|  PASSED
      rgb_lagged_sum|  10|   1000000|     100|0.98408496|  PASSED
      rgb_lagged_sum|  11|   1000000|     100|0.16444305|  PASSED
      rgb_lagged_sum|  12|   1000000|     100|0.76625717|  PASSED
      rgb_lagged_sum|  13|   1000000|     100|0.35852738|  PASSED
      rgb_lagged_sum|  14|   1000000|     100|0.87085356|  PASSED
      rgb_lagged_sum|  15|   1000000|     100|0.61739962|  PASSED
      rgb_lagged_sum|  16|   1000000|     100|0.99887454|   WEAK
      rgb_lagged_sum|  17|   1000000|     100|0.57242899|  PASSED
      rgb_lagged_sum|  18|   1000000|     100|0.14832268|  PASSED
      rgb_lagged_sum|  19|   1000000|     100|0.88423970|  PASSED
      rgb_lagged_sum|  20|   1000000|     100|0.94143615|  PASSED
      rgb_lagged_sum|  21|   1000000|     100|0.20977147|  PASSED
      rgb_lagged_sum|  22|   1000000|     100|0.92850949|  PASSED
      rgb_lagged_sum|  23|   1000000|     100|0.01369631|  PASSED
      rgb_lagged_sum|  24|   1000000|     100|0.92801560|  PASSED
      rgb_lagged_sum|  25|   1000000|     100|0.95202948|  PASSED
      rgb_lagged_sum|  26|   1000000|     100|0.73602992|  PASSED
      rgb_lagged_sum|  27|   1000000|     100|0.99833256|   WEAK
      rgb_lagged_sum|  28|   1000000|     100|0.37130238|  PASSED
      rgb_lagged_sum|  29|   1000000|     100|0.75334878|  PASSED
      rgb_lagged_sum|  30|   1000000|     100|0.81701614|  PASSED
      rgb_lagged_sum|  31|   1000000|     100|0.55603890|  PASSED
      rgb_lagged_sum|  32|   1000000|     100|0.44022176|  PASSED
     rgb_kstest_test|   0|     10000|    1000|0.37238978|  PASSED
     dab_bytedistrib|   0|  51200000|       1|0.91968651|  PASSED
             dab_dct| 256|     50000|       1|0.28884994|  PASSED
Preparing to run test 207.  ntuple = 0
        dab_filltree|  32|  15000000|       1|0.94992945|  PASSED
        dab_filltree|  32|  15000000|       1|0.79630732|  PASSED
Preparing to run test 208.  ntuple = 0
       dab_filltree2|   0|   5000000|       1|0.26801324|  PASSED
       dab_filltree2|   1|   5000000|       1|0.25782213|  PASSED
Preparing to run test 209.  ntuple = 0
        dab_monobit2|  12|  65000000|       1|0.64526152|  PASSED
Preparing to run test 210.  ntuple = 0
      dab_birthdays1|  32|      2000|       1|0.39904740|  PASSED
Preparing to run test 211.  ntuple = 0
           dab_opso2|   0|  67108864|       1|0.80823024|  PASSED
           dab_opso2|   1|  67108864|       1|0.77515668|  PASSED

You can compare my DIEHARDER results to those
previously published by Aaron Toponce in June 2015 here
(he has ONLY ONE WEAK result from DIEHARDER; I have SIX.  There are 117 tests, so 6 yields 95% PASS).

I then re-ran the 32x32 (test#2) 25 times to see if the "WEAK" was an anomaly or not.
Each "diehard_rank_32x32" test creates 40,000 matrices, 
each matrix requires 32 32-bit integer (one 32-bit integer per row), and there are 100 tests in the outer loop.
Therefore each test output row involves 128 Million 32-bit integers from RTL_ENTROPY,
and dieharder ran for 107 minutes each row below.

  diehard_rank_32x32|   0|     40000|     100|0.19888078|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.53906082|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.58307515|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.49910213|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.56529609|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.85319220|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.22101181|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.15303211|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.17477532|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.92216808|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.72614702|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.06066570|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.75494242|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.55839873|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.88323916|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.53863629|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.83320875|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.01943763|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.77648824|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.29465903|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.01910060|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.25232394|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.15181811|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.03569629|  PASSED
  diehard_rank_32x32|   0|     40000|     100|0.03290346|  PASSED

I then re-ran 25 of the sts_serial with ntuple "2", all PASSED: 

  sts_serial|   2|    100000|     100|0.96447993|  PASSED
  sts_serial|   2|    100000|     100|0.98375350|  PASSED
  sts_serial|   2|    100000|     100|0.33643093|  PASSED
  sts_serial|   2|    100000|     100|0.56788115|  PASSED
  sts_serial|   2|    100000|     100|0.82096485|  PASSED
  sts_serial|   2|    100000|     100|0.94138549|  PASSED
  sts_serial|   2|    100000|     100|0.45057565|  PASSED
  sts_serial|   2|    100000|     100|0.17053015|  PASSED
  sts_serial|   2|    100000|     100|0.68875079|  PASSED
  sts_serial|   2|    100000|     100|0.07834579|  PASSED
  sts_serial|   2|    100000|     100|0.92788066|  PASSED
  sts_serial|   2|    100000|     100|0.91573065|  PASSED
  sts_serial|   2|    100000|     100|0.15092063|  PASSED
  sts_serial|   2|    100000|     100|0.15905696|  PASSED
  sts_serial|   2|    100000|     100|0.22855126|  PASSED
  sts_serial|   2|    100000|     100|0.34435174|  PASSED
  sts_serial|   2|    100000|     100|0.43307661|  PASSED
  sts_serial|   2|    100000|     100|0.78257387|  PASSED
  sts_serial|   2|    100000|     100|0.35265881|  PASSED
  sts_serial|   2|    100000|     100|0.93209055|  PASSED
  sts_serial|   2|    100000|     100|0.72729215|  PASSED
  sts_serial|   2|    100000|     100|0.11827871|  PASSED
  sts_serial|   2|    100000|     100|0.45067978|  PASSED
  sts_serial|   2|    100000|     100|0.40115223|  PASSED
  sts_serial|   2|    100000|     100|0.91691348|  PASSED

I then ran sts_serial with ntuple "11" and this test seems a bit problematic,
returned 2 WEAK out of 25 (plus the original WEAK result above too).

  sts_serial|  11|    100000|     100|0.10160140|  PASSED
  sts_serial|  11|    100000|     100|0.56335002|  PASSED
  sts_serial|  11|    100000|     100|0.78215049|  PASSED
  sts_serial|  11|    100000|     100|0.97479609|  PASSED
  sts_serial|  11|    100000|     100|0.26638537|  PASSED
  sts_serial|  11|    100000|     100|0.69398282|  PASSED
  sts_serial|  11|    100000|     100|0.69368919|  PASSED
  sts_serial|  11|    100000|     100|0.17909242|  PASSED
  sts_serial|  11|    100000|     100|0.17341963|  PASSED
  sts_serial|  11|    100000|     100|0.35759397|  PASSED
  sts_serial|  11|    100000|     100|0.96042131|  PASSED
  sts_serial|  11|    100000|     100|0.99902130|   WEAK
  sts_serial|  11|    100000|     100|0.74729618|  PASSED
  sts_serial|  11|    100000|     100|0.99950780|   WEAK
  sts_serial|  11|    100000|     100|0.56962753|  PASSED
  sts_serial|  11|    100000|     100|0.77115708|  PASSED
  sts_serial|  11|    100000|     100|0.81174464|  PASSED
  sts_serial|  11|    100000|     100|0.22564553|  PASSED
  sts_serial|  11|    100000|     100|0.93390450|  PASSED
  sts_serial|  11|    100000|     100|0.77975011|  PASSED
  sts_serial|  11|    100000|     100|0.56059293|  PASSED
  sts_serial|  11|    100000|     100|0.20433505|  PASSED
  sts_serial|  11|    100000|     100|0.19575804|  PASSED
  sts_serial|  11|    100000|     100|0.75399785|  PASSED
  sts_serial|  11|    100000|     100|0.69606328|  PASSED

I then ran rgb_lagged_sum with ntuple="1" 25 times, got one WEAK result.

  rgb_lagged_sum|   1|   1000000|     100|0.24833284|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.24504621|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.77163655|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.41228058|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.07559481|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.49245673|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.33644154|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.83289782|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.23603600|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.88247951|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.82565886|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.95899822|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.91910558|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.99860214|   WEAK
  rgb_lagged_sum|   1|   1000000|     100|0.71499733|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.64692191|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.98100245|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.87432142|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.41076197|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.13731191|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.88363177|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.65681592|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.42133829|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.76786586|  PASSED
  rgb_lagged_sum|   1|   1000000|     100|0.76494290|  PASSED

I then ran rgb_lagged_sum with ntuple=16, five additional times.
This test evaluates the cumulative sum of pairs of values separated by 
a specific lag (determined by the ntuple parameter).
Each test reads in 1,000,000 + ntuple  values, which are processed in pairs.
Each value is 4 bytes (32 bits). 
Across 100 tests, this is: 1,000,016 * 32 bits * 100 = 3.2 Billion bits (400 megabytes).

  rgb_lagged_sum|  16|   1000000|     100|0.18442995|  PASSED
  rgb_lagged_sum|  16|   1000000|     100|0.55103479|  PASSED
  rgb_lagged_sum|  16|   1000000|     100|0.88642300|  PASSED
  rgb_lagged_sum|  16|   1000000|     100|0.89111128|  PASSED
  rgb_lagged_sum|  16|   1000000|     100|0.68152244|  PASSED

One of the facts I belatedly learned from "rtl_entropy -h" after running all of the 
time-consuming tests above, is that the default sample size (bandwidth) for rtl_entropy is 3,200,000
(which I believe is at the upper limit of what the RTL-SDR V3 can do: most of the time we use 2,400,000)

I had not been paying much attention to the "FIPS Failed" messages which rtl_entropy outputted continuously,
(because these are "skipped" blocks) but when I added "--sample_size 1200000" 
and then also tried "--sample_size 1000000" 
I got very few of these FIPS block messages.  So, my command line is now: 

         rtl_entropy -f 74M --sample_size 1000000

and rtl_entropy is running much better now
(dropping very few blocks due to bad quality)

 rgb_lagged_sum|  27|   1000000|     100|0.96207213|  PASSED
 rgb_lagged_sum|  27|   1000000|     100|0.41779698|  PASSED
 rgb_lagged_sum|  27|   1000000|     100|0.93372585|  PASSED
 rgb_lagged_sum|  27|   1000000|     100|0.12001543|  PASSED
 rgb_lagged_sum|  27|   1000000|     100|0.37449670|  PASSED

Understanding dieharder Metrics: tsamples and psamples

  1. tsamples (Test Samples)
    • What it is: The number of individual random samples or data points consumed within a single trial of a specific test.
    • Role: For example, if a test requires rolling a simulated die or examining bit sequences, tsamples defines how large that individual batch of data is. Each complete pass through this batch generates one raw statistical result, which is then converted into a single p-value.
  2. psamples (P-values / Test Rounds)
    • What it is: The number of independent p-values generated to create the final assessment.
    • Role: dieharder repeats the primary test psamples times (e.g., usually defaulting to 100 independent runs). It collects all 100 individual p-values and runs a secondary K-S test to verify that the p-values themselves are uniformly distributed between 0 and 1. The final p-value displayed in the summary table is the result of that meta-test across all psamples.

Summary of the Relationship

So, for example, to produce that single row of output for rgb_lagged_sum, dieharder consumes 1,000,000 samples × 100 trials = 100,000,000 individual data points. Each of those 100 trials yields its own intermediate value, and the final p-value in the column is derived from evaluating the distribution of all 100 trials together via a Kolmogorov-Smirnov test.

Running the full suite of Dieharder tests (dieharder -g 200 -a) ingests over 7 billion 32-bit random integers (exceeding 28 gigabytes of continuous raw data) to satisfy the statistical sample requirements across its randomness tests!

Comment about: Too High (p > 0.99) = "WEAK" (Suspiciously Perfect)
  • What it means: The data matches the theoretical model almost too well.
  • Example: If you simulated a coin flip by alternating perfectly: "H, T, H, T, H, T" for a million steps, it would pass a simple "is it 50% heads?" test, but fail deeper structural tests because real randomness has "clumps" and natural variance.
  • When a test flags a "WEAK" at 0.999 (like the sts_serial result), it usually means the debiasing algorithm (or the conditioning step) flattened out the natural statistical variance so heavily that it started looking artificially uniform.

Running the full suite of Dieharder tests ("dieharder -g 200 -a") ingests more than 7 billion 32-bit random integers (exceeding 28 gigabytes of continuous raw data from the RTL-SDR) to satisfy the statistical sample requirements across its 114 randomness tests! (and took multiple days to generate and run).


Custom Extraction via Python & LSB

RTL-ENTROPY is NOT the only way to get entropy from the RTL-SDR device. You can use the “regular” rtl_sdr program, and some Python, to extract only the LSB (Least Significant Bit):

rtl_sdr -f 140M -s 2400000 -g 0 -n 1000000 - | python3 -c '
import sys
def unbias_lsb_pack():
    out_byte = 0
    bit_count = 0
    
    while True:
        chunk = sys.stdin.buffer.read(2)
        if len(chunk) < 2:
            break
        
        bit1 = chunk[0] & 1
        bit2 = chunk[1] & 1
        
        if bit1 != bit2:
            out_byte = (out_byte << 1) | bit1
            bit_count += 1
            
            if bit_count == 8:
                sys.stdout.buffer.write(bytes([out_byte]))
                out_byte = 0
                bit_count = 0
unbias_lsb_pack()
' | xxd

Alternatively, using SHA-256 conditioning:

rtl_sdr -f 140M -s 2400000 -g 0 -n 4194304 - | python3 -c '
import sys, hashlib
def conditioned_entropy():
    out_byte = 0
    bit_count = 0
    buffer = bytearray()
    
    while True:
        chunk = sys.stdin.buffer.read(2)
        if len(chunk) < 2:
            break
        
        bit1 = chunk[0] & 1
        bit2 = chunk[1] & 1
        
        if bit1 != bit2:
            out_byte = (out_byte << 1) | bit1
            bit_count += 1
            
            if bit_count == 8:
                buffer.append(out_byte)
                out_byte = 0
                bit_count = 0
                
                if len(buffer) == 64:
                    digest = hashlib.sha256(buffer).digest()
                    sys.stdout.buffer.write(digest)
                    buffer.clear()
conditioned_entropy()
' | xxd

Data Reduction Pipeline

Note that -n 1000000 outputs one million raw samples, but taking only the LSB yields 125,000 packed bytes. Von Neumann unbiasing reduces this further (~2:1), and SHA-256 conditioning brings it down to 31,264 bytes output.

1,000,000 Bytes Raw IQ Samples 
       │ 
       ▼ 
[Stage 1: LSB Extraction (& 1)] 
       └── Drops 7 out of 8 bits per byte. 
       └── Yields: 125,000 Bytes (8:1 reduction)
       │ 
       ▼ 
[Stage 2: Von Neumann Unbiasing] 
       └── Drops matching pairs (00 and 11); keeps mismatched pairs (01/10). 
       └── Yields: ~62,528 Bytes (~2:1 reduction)
       │ 
       ▼ 
[Stage 3: SHA-256 Conditioning] 
       └── Hashes 64-byte blocks into 32-byte digests. 
       └── Yields: 31,264 Bytes (2:1 reduction)

Step-by-Step Breakdown


Using RTL-SDR USB to inject Entropy into Linux /dev/random via rngd

Because specialized software like rtl_entropy interfaces directly with the hardware via librtlsdr, it bypasses external capture binaries, pulling raw atmospheric and thermal noise straight from the tuner. Once collected and debiased, this stream can be bridged into the operating system to seed the kernel's cryptographic randomness pools (/dev/random and /dev/urandom) via rngd.

1. The Direct-Harvest Architecture

2. Kernel Integration via rngd

rngd (the Hardware Random Number Generator Daemon) is a standard userspace utility packaged as part of rng-tools. As noted in its documentation:

“This daemon feeds data from a random number generator to the kernel's random number entropy pool, after first checking the data to ensure that it is properly random.”

rngd uses the RNDADDENTROPY ioctl on /dev/random (or /dev/urandom) to inject both the random data and an entropy credit into the kernel's input pool in a single privileged operation.

3. Under the Hood: The Mechanism

4. Implementation Example

To feed this hardware-derived stream directly into the Linux kernel's entropy pool with proper crediting, initialize the pipeline via daemon mode and pipe it into rngd:

# Running rtl_entropy in daemon mode and routing its FIFO into the kernel via rngd
sudo rtl_entropy -f 74M -b
sudo rngd -f -r /var/run/rtl_entropy.fifo

By anchoring the system's entropy pool to physical, ambient noise gathered from a legally protected radio astronomy band, this configuration ensures that the operating system's cryptographic keys and secure session tokens are insulated from predictable software patterns or boot-time starvation.


Additional Resources