rng

The arduino has multiple i/o pins. 8 analogue and 14 digital pins. When nothing is connected to them, their value "floats"; reading them returns a random value. This property is used in this Arduino-sketch.

This sketch produces random values. You can use those to e.g. create encryption keys or to fill the Linux "/dev/random" kernel entropy pool.

It works like this:

  • a sample is taken from two pins
  • von Neumann whitening is applied
  • the data is send via the serial pins to the Linux server
  • the linux server runs a program that receives the random data and saves it to a file or feeds it to the linux kernel

You cannot directly pipe the serial device to a file or so because the stream is encapsulated and also contains meta-data (error counts etc).

Depending on the maker of the Arduino, the output is +/- 1500 bits per second or 15MB per day. It indeed depends on who build the board: some designs generate more noise on the analogue and digital pins than others.

Sofar (the test requires 2GB of data, I tested it with 100MB) the diehard (statistical-)tests considers the output truly random.

Arduino Nano sketch and Linux interfacing daemon: GitHub.

Note: do not connect anything to any of the digital or analogue pins! For this to work they are supposed to float which only happens with nothing connected.


arduino menu





feedback