Page 1 of 1
Need True Random number Generator
Posted: Tue Feb 16, 2016 11:13 pm
by ashishkumar4
The OSDev wiki states that "True random number generators use physical devices to generate random numbers, whose unpredictability can be traced to the laws of quantum mechanics." Okay, unpredictability is in every part of the laws of quantum mechanics which itself is probabilistic. But how to actually use it to get the random numbers? How to use the 'physical devices'? any example in C please? Please help me, cant find any help on google as of yet :p
Re: Need True Random number Generator
Posted: Wed Feb 17, 2016 12:00 am
by neon
Hello,
There are plenty of resources on
hardware random number generators and quantum random number generators, such as the
Quantis TRNG. You would need to interface with these hardware devices which is independent of the language and is specific to that device thus making any common example impossible.
Re: Need True Random number Generator
Posted: Wed Feb 17, 2016 12:22 am
by ashishkumar4
Means using specific hardwares and not any hardware? :/ Any other way to generate truly random numbers (not the RTC one)
Re: Need True Random number Generator
Posted: Wed Feb 17, 2016 12:29 am
by neon
You need special hardware to generate true random numbers. There is no way to do it without such hardware; the most you can do is
pseudorandom. This is fine for most applications and video games, so I really don't quite see a problem personally. RTC (and other timers) has nothing to do with random numbers but the current clock tick can certainly be used to seed a base value for generating a pseudorandom number.
Re: Need True Random number Generator
Posted: Wed Feb 17, 2016 2:01 am
by ashishkumar4
ya was talking about that only. how does Linux does it?? atleast I can make pretty hard to prefict pseudo randoms :p for my lottery scheduling :p
Re: Need True Random number Generator
Posted: Wed Feb 17, 2016 2:15 am
by onlyonemac
ashishkumar4 wrote:ya was talking about that only. how does Linux does it?? atleast I can make pretty hard to prefict pseudo randoms :p for my lottery scheduling :p
I'm not sure of the implementation details but in short Linux uses arbitrary pieces of data from as many sources as possible (including, most importantly, device drivers) as a source of "random noise" for the random number generator. The more sources of data there are, the better this works. A lot of the randomness comes down to the randomness of the user - for example, one source of data is the mouse driver, and the randomness therein lies in the many different ways that the user moves the mouse, and likewise with the hard drive driver, where the randomness comes from the user's interaction with the computer and what hard drive activity that causes.
Re: Need True Random number Generator
Posted: Wed Feb 17, 2016 2:22 am
by neon
There is an interesting paper on the topic
here. I have not read through all of it yet but it is quite complicated.
Re: Need True Random number Generator
Posted: Wed Feb 17, 2016 4:15 pm
by Schol-R-LEA
Wikipedia: Hardware Random Number Generator
Some, though AFAIK not all or even most, modern motherboards do incorporate a thermal-noise HRNG; if yours does, you would need the details of the specific hardware, or its chipset API, in order to access it. Since this is not well standardized, it would have to a hardware-specific driver, so it could not be relied on for general use on stock hardware.
Perhaps more fruitfully, the latest Intel (since 2013) and AMD (since 2015) x86-64 CPUs incorporate an instruction,
RDRAND, that combines multiple entropy sources with an AES conditioning algorithm and a pseudo-random number algorithm to produce (supposedly) cryptographically secure random values. There is some controversy in using it, however,; while AFAIK no backdoors have been reproducibly reported in the Intel or AMD entropy production mechanisms, there's enough doubt of their honestly and lack of faults that hardly anyone wants to use the output without some sort of additional entropy generation. Most RNGs that use it only take as one randomness source out of many, for example using it to select from a set of several PRNGs for generating a sequence numbers over a given time frame (say, half a second), shuffle the PRNG list, generate a seed for the PRNG, and/or set the time for the next re-seeding.
Re: Need True Random number Generator
Posted: Wed Feb 17, 2016 8:47 pm
by ashishkumar4
:O never knew about that. gonna search more on this