[Zach] sent in a project he’s been working on that brings hardware random number generators to common hardware you might have lying around. It’s called Whirlyfly and it turns an FPGA dev board into a hardware random number capable of outputting random bits over a USB connection at 3 Mbps.
Previously, the whirlygig ran on a custom CPLD that interfaced to a *nix box and provided high quality random numbers via /dev/hw_random. [Zach]’s efforts takes the core of the whirlygig and ports it to the very popular and inexpensive Papilio One FPGA dev board.
As for what [Zach] can do with his random number generator, it’s extremely easy to write a Monte Carlo experiment to approximate the value of π with a better accuracy than [Ptolemy] was able to muster 1900 years ago. There’s also the aspect of encryption, and – why you would do this we have no idea – making an uncompressable file is also possible.
Random number generation is a frequent topic of discussion in projects that involve encryption and security. Intel has just announced a new feature coming to many of their processors that affect random number generation.
The random number generator, which they call Bull Mountain, marks a departure from Intel’s traditional method of generating random number seeds from analog hardware. Bull Mountain relies on all-digital hardware, pitting two inverters against each other and letting thermal noise tip the hand in one direction or the other. The system is monitored at several steps along the way, tuning the hardware to ensure that the random digits are not falling more frequently in one direction or the other. Pairs of 256-bit sequences are then run through a mathematical process to further offset the chance of predictability, before they are then used as a pseudorandom number seed. Why go though all of this? Transitioning to an all-digital process makes it easier and cheaper to reduce the size of microchips.
A new instruction has been added to access this hardware module: RdRand. If it works as promised, this should remove the need for elaborate external hardware as a random number source.
[littlebird] posted a tutorial on making electronic dice. He’s using an ATmega328 for the numbers work, and a mercury switch to activate it all. A nice blue enclosure to match the blue LEDs he’s using for the number display wraps it up nicely. Of course, someone had to mention that this was an amazing amount of over kill and it could just be done with a 555 timer like they used to do “back in the day”. [littlebird] responded with another tutorial to prove that he hadn’t forgotten how to work with the basics. He goes on to point out, now that we see both in action, that he can expand his microcontroller based one quickly with a few lines of code, where every new feature added to the 555 timer version would require additional components.
You can catch videos of both after the break.
Continue reading “Electronic dice, overkill and simplified”
True randomness can be hard to come by in the digital world. [Andy Green] is making it easier to get true entropy by using this random USB dongle. The Whirlygig uses a CPDL to gather data from a set of of oscillators. The oscillators have a constantly fluctuating frequency due to temperature changes; if they run faster they generate more heat which in turn slows them down. This, along with the variable latency associated with polling a USB device, gives great depth of randomness. The device is detected and mounted under ‘/dev/hw_random’ and can then be fed into ‘/dev/random’ using the rng-tools package. [Andy’s] done a lot of testing, both on the hardware, and on the quality of randomness. We didn’t see an option to order this but he’s got hardware and firmware repositories so that you can throw one together yourself.
[Peter] thought of a creative, way to generate random entropy for under $100.
The USB Hourglass combines a sand timer with a rotating mechanism and an optical beam through the center of the timer to observe the falling sand. The amount of light reaching a detector is digitized at frequent intervals and processed by a microcontroller to determine when to rotate the hourglass. The digitized light levels are also sent by USB to a host PC where they can be used as a source of random entropy. Power is supplied over the USB cable.
With the USB Hourglass, the user can look at the sand falling through the center of the hourglass and monitor the randomness in the USB output data. And one can read the code line-by-line, compile it, and upload it to the microcontroller using only open-source and widely supported tools.
[MS3FGX] has done an interesting study about using Bluetooth adapters as a source for Pseudorandom Number Generation (PRNG). As it turns out, the Bluez package has a function that calls a remote Bluetooth adapter to return a random number. He picked up 10 compatible adapters for about $30 from DealExtreme and set about assembling some numbers to see how this compares to an OS-based PRNG.
Because millions of samples are needed for an accurate comparison, time became a problem. The adapters are a little bit slow responding to a request, sending just 4800 numbers in the first 30-second test. This can be overcome with multiple adapters being accessed by multiple computers for hours at a time. What can this be used for? Your guess is as good as ours, but [MS3FGX] has done a great job of writing up his tests. He’s also made a set of 20.7 million randomly generated values available if you want to generate your own statistical analysis.
[Scott] runs gamesbyemail.com. One of his biggest hurdles was producing real random numbers for the games. He had tried various methods like math.random and random.org, but kept getting complaints about the quality of the random numbers. His solution was to build an automatic dice roller. His initial attempts were made from Legos and were never quite reliable enough to be put into the system. The Dice-O-Matic however has proven to be a random number generating monster. It is 7 feet tall and capable of 1.3 million dice rolls per day. Wow.