Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows equivalent of /dev/random [closed]

Tags:

random

windows

Is there a Windows equivalent of Linux's /dev/random?

like image 211
Ian G Avatar asked Oct 10 '08 13:10

Ian G


People also ask

Does Windows have dev random?

Cygwin on Windows provides implementations of both /dev/random and /dev/urandom, which can be used in scripts and programs.

What is the difference between Dev random and Dev urandom?

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.

Why is Dev random read only?

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.

Why does Dev random block?

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.


2 Answers

Yes, it's called Microsoft CryptoAPI.

like image 154
Bill the Lizard Avatar answered Sep 21 '22 03:09

Bill the Lizard


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.

like image 29
cxxl Avatar answered Sep 24 '22 03:09

cxxl