Entropy for Random Number Generation

In summary, the author wants to generate very random numbers. He has three approaches:- Using an audio input de-tuned radio- Hooking user input such as mouse movement- Hashing the results over a period of time.One way to generate random numbers is to use an entropy pool. A cheap Geiger Counter can be used to monitor background radiation and the least significant few bits of the timer can be used to extend the entropy pool. Left on for long enough and used in combination with other methods, a PRNG can be created. Another way to generate random numbers is to use /dev/urandom and /dev/random. /dev/urandom is an overkill most of
  • #1
Boltar
5
0
I want to generate very random numbers. There's a few approaches to this, such as the audio input from a de-tuned radio, hooking user input such as mouse movement and hashing the results over a period of time etc.. My idea was to get a cheap Geiger Counter and just leave it monitoring background radiation, use this in combination with a nano second resolution clock, each time a discharge event is detected, the least significant few bits of the timer is then used to extend the entropy pool. Left on for long enough and used in combination with other methods. Particularly, I need the numbers to be suitable for emulating quantum level events.
 
Engineering news on Phys.org
  • #2
I do not know what you are asking for as help exactly, but what you describe derives from something Matt Blaze wrote circa 1995 - truerand. It's descendants are used to populate entropy pools, for example in linux: /dev/random

UNIX C code example:
www.cs.miami.edu/~burt/learning/Math609.../unix_truerand.c
I hope the link works correctly.

Note that a good entropy pool should block on read when exhausted. Most of what you are asking seems really better suited to PF's Electrical Engineering forum.
 
  • #3
For 40 dollars you can get http://onerng.info/index.html which is open source hardware. It's not exactly what you had in mind but it does the job you had in mind.
On the other hand, one doesn't really need the entropy pool to be full for most cases. Even password generators don't use /dev/random, they use /dev/urandom instead (which never block). Here are some myths about /dev/urandom and /dev/random.
http://www.2uo.de/myths-about-urandom/
 
  • #7
jim mcnamara said:
@fluidistic
I disagree about /dev/random vs /dev/urandom, plus password generators are not indicative of quality of PRNGs, IMO:
http://ieeexplore.ieee.org/document/1624027/

In fact neither /dev/random nor /dev/urandom is a really good PRNG, but these guys are promoting something else, so take it as it is:
http://dl.acm.org/citation.cfm?id=2516653

Both of these links are behind a paywall ... sorry.
About the disagreement you have between /dev/random and /dev/urandom you mean the former should be used over the latter in most cases? The point of the document is that /dev/random is an overkill most of the time, including for SHA key generation (!). This is also the impression I gather from reading Unix Stack Overflow (for instance https://unix.stackexchange.com/questions/220228/is-it-bad-to-have-a-low-entropy-in-dev-random) and on IRC in both #linux and ##security.

About the papers you menion, one can find both of them in PDF format with google. First one is from 2006 and a huge security patch has been applied in 2012 so I highly doubt what is in the paper is still relevant. The second one has been kind of debugged by the /dev/random maintainer itself at https://news.ycombinator.com/item?id=6548893. I'm not an expert at all in these things but his arguments seems convincing...

Also there's a reason why both /dev/urandom and /dev/random are still used in practice. Note that I'm not saying that /dev/random and /dev/urandom are perfect or can't be improved. But in practice they are more than enough (/dev/urandom might not be enough on some hardware where the entropy is very low on a fresh boot up or so, apparently).

Edit : Another confirmation by an expert : https://security.stackexchange.com/questions/3936/is-a-rand-from-dev-urandom-secure-for-a-login-key. I quote:
the only instant where /dev/urandom might imply a security issue due to low entropy is during the first moments of a fresh, automated OS install
so I was wrong to state after a fresh reboot, it is after a fresh install. Probably because the seed is saved before shutting down so that when you reboot the seed cannot be predicted.

Edit 2 : And another one (see the most upvoted answer at https://stackoverflow.com/questions/5635277/is-dev-random-considered-truly-random , I quote
There are many applications which read /dev/random as a kind of ritual, as if it was "better" than /dev/urandom, probably on a karmic level. This is plain wrong, especially when the alea is to be used with classical cryptographic algorithms (e.g. to generate a SSH server public key). Do not do that. Instead, use /dev/urandom and you will live longer and happier. Even for one-time pad.
. Etc.
 
Last edited:
  • #8
Based on the slightly vague query, I am guessing the OP would need to use /dev/random. It is hard to tell. I assume the OP wants to do some sort of Monte Carlo analysis - again guesswork. Maybe the OP will enlighten us. Then I can stop making a fool of myself...
 
  • #9
Sorry for the vagueness, I'm basically trying to create a quantum level emulator and give it various scenarios. I'm a complete newbie at all this but I'm pretty sure quantum level events are about as random as you can get, so emulating them would need a decent RNG. I've still got a long way to go (and many more questions to ask) before even 1 line of code is written however. The start scenario will probably be a dual slit experiment emulation. The goal of course being to obtain real world results using the simplest rule set.
 

Related to Entropy for Random Number Generation

1. What is entropy in the context of random number generation?

Entropy refers to the measure of randomness or uncertainty in a system. In the context of random number generation, it is used to quantify the unpredictability of a sequence of numbers.

2. Why is entropy important in random number generation?

Entropy plays a crucial role in ensuring the randomness of generated numbers. Higher levels of entropy result in more unpredictable and truly random sequences, making them more suitable for applications such as cryptography and simulations.

3. How is entropy calculated for random number generation?

Entropy is typically calculated using statistical methods, such as the Shannon entropy formula, which takes into account the frequency of each number in a sequence. Other methods, such as the Kolmogorov-Smirnov test, can also be used to measure entropy.

4. Can entropy be controlled or manipulated for better random number generation?

While entropy itself cannot be controlled or manipulated, it can be influenced by the quality of the random number generator used. A high-quality generator with proper seeding and algorithms can result in higher entropy and therefore more random numbers.

5. How does entropy relate to the security of random number generation?

Entropy is a critical factor in the security of random number generation, particularly in cryptography. Low levels of entropy in a random number generator can make it vulnerable to attacks and compromise the security of encrypted data. Therefore, it is important to use generators with high entropy for secure applications.

Similar threads

Replies
19
Views
4K
Replies
3
Views
5K
  • Programming and Computer Science
Replies
4
Views
5K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
5K
  • STEM Academic Advising
Replies
6
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
6K
  • Linear and Abstract Algebra
Replies
2
Views
9K
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
Back
Top