2

Is there a pseudo device-based random data stream/file that can be used in Windows .NET programming in the same way as /dev/random can be read and used as a source of random values on Linux based systems?

I’m not asking whether .NET can provide a pseudo-random number generator type random call such as CryptGenRandom() which appears to use a random seed to create a sequence of PRNG numbers but whether there is a functional equivalent as /dev/random which stores various system events and UI interaction to create a pool of random values that are considered to be crypto secure.

Because /dev/random appears to be similar to any other file on the underlying system, any Linux based programming language can access this truly random stream of data, but C# and other .NET programs don’t (normally) run on Linux systems, and mine certainly don’t.

All online searches and my reading always leads me to information about PRNG calls, which is not the same thing at all.

If there’s any answer to this on here already then I just need more practice on searching for answers I guess!

David Scholefield
  • 1,824
  • 12
  • 21

1 Answers1

4

There is no built-in file-like interface to a source of randomness or entropy, if that is what you mean.

Unix-style operating systems such as Linux try to fit everything in a file, but Windows doesn't adhere to that approach and uses a function call instead.

This page has a random device driver to create a file like /dev/random on Windows. I don't know how well that works, and it uses RtlRandom and not CryptGenRandom.

Sjoerd
  • 28,707
  • 12
  • 74
  • 102
  • 1
    As a quick note, RtlRandom is not a cryptographically secure PRNG. CryptGenRandom and [RtlGenRandom](https://msdn.microsoft.com/en-us/library/windows/desktop/aa387694(v=vs.85).aspx) however, are. – Xander Jun 02 '17 at 18:28