Talk:Random number generator (device): Difference between revisions

/dev/urandom
No edit summary
(/dev/urandom)
Line 1:
==Primer notes==
On Linux, reading from /dev/urandom pulls from the system entropy pool (which may contributed to by HRNGs, among other sources), but provides psuedorandom numbers if that entropy pool dries up. reading from /dev/random, on the other hand, pulls from the same entropy pool, but blocks whenever the entropy pool dries up. --[[User:Short Circuit|Michael Mol]] 14:03, 11 January 2011 (UTC)
 
: I guess that a solution may use either /dev/random or /dev/urandom. The entropy pool probably has enough entropy for a 32-bit integer. I prefer to use /dev/urandom. Many kernels use a secure hash, like SHA1, to convert the entropy pool to random numbers. ([http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rndpool.c?rev=1.20&content-type=text/x-cvsweb-markup&only_with_tag=MAIN NetBSD uses SHA1.]) Even if the entropy pool is dry, the random numbers should remain secure. I guess that you would have to reverse or defeat SHA1 to replicate the pseudorandom numbers from a dry pool; but SHA1 is a secure hash so difficult to reverse.
 
: OpenBSD 4.8 and before had /dev/urandom giving random numbers, but /dev/random giving only errors. (This was because /dev/random was a reserved device, and /dev/srandom of OpenBSD was like /dev/random of Linux.) So /dev/urandom was better than /dev/random for OpenBSD. This has changed with OpenBSD 4.9 (from May 2011); now /dev/random also gives random numbers. So if some example on Rosetta Code uses /dev/random, I will not care to change it to /dev/urandom. --[[User:Kernigh|Kernigh]] 04:47, 8 May 2011 (UTC)
 
==Libraries and features==
Anonymous user