A random number generator that uses your webcam's CCD noise as an entropy source.
(NOTE: This is a work in progress, and should not be used for mission critical applications like protecting nuclear secrets or shuffling poker decks. That said, preliminary testing has shown that, even at this early stage, we're generating good random numbers!)
- Python 2.7
- OpenCV 2.x Python bindings
First, clone the git repo:
git clone https://github.com/epitron/webcam-rng
Next, install the python opencv2 bindings (if you haven't yet)...
$ apt-get install python-opencv
$ dnf install python2-opencv
RHEL7/CentOS7/Scientific Linux 7:
Note: ensure to have
optional repo enabled:
$ yum install opencv-python
$ pacman -S opencv
Sorry, you're on your own!
$ ./webcam-rng.py 0
0 is the first video device,
1 is the second, etc.)
- Point your webcam at a stationary object, like a wall
- Bask in the glorious entropy!
Random nubmers will be written to
rand.dat. You can set the filename by passing an extra commandline argument:
$ ./webcam-rng.py 0 really-random.dat
Statistical tests of generated entropy:
- Dieharder statistical tests
- ent entropy estimator
- Diehard statistical tests
- Randomness tests (Wikipedia)
Use the CCD noise more effectively:
We should be able to get much more than 64-bytes of entropy out of each webcam frame (depending on how crappy the webcam is).
Doing a very crude test, 256 frames of webcam noise (235 MB of data) compresses down to 55 MB using LZMA. This means that there is potentially about 200k of entropy in each frame (a firehose of entropy, compared to the 64 bytes it's currently getting.)
- Webcam Random Number Generator (using pyblake2 to hash the images)
- Hardware RNG (Wikipedia)
WTFPL2, as usual. :)
(c) 2014 by Chris Gahan (firstname.lastname@example.org)