Is there a Windows equivalent of Linux's /dev/random?
Cygwin on Windows provides implementations of both /dev/random and /dev/urandom, which can be used in scripts and programs.
The key difference between /dev/random versus /dev/urandom is whether a threshold of enough entropy has to be reached before random numbers are generated. Reading from /dev/random will be put on hold if the kernel has not gathered enough entropy to provide the requested amount of data.
Reading from /dev/random is non-determinstic, because all it does is fetch the requested number of bits from the random pool. It will block until it can read the requested number of bits. /dev/urandom, however, is the kernel's PRNG, and can supply a near-infinite stream of pseudo-random numbers.
In those older kernels, /dev/random would block because the blocking entropy pool had been depleted. However, changes to the algorithms used in ealier kernels meant that there was no longer any useful distinction between the blocking and non-blocking entropy pools.
Yes, it's called Microsoft CryptoAPI.
This link from StingyJack's answer is good: http://en.wikipedia.org/wiki/CryptGenRandom
Microsoft C++ Visual Studio since 2005 offers rand_s()
which works on Windows XP and up. It is based on RtlGenRandom
(as are CryptoAPI's PRNG functions), whose inner workings are not made public. It seems in XP there were some weaknesses that have since been fixed.
Personally, I use rand_s()
as an additional source of randomness to seed a PRNG of my choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With