Tuesday, October 12, 2004

Is System.Random class - Cryptographically secure?

In the .NET Framework, System.Random uses an algorithm based on the subtractive method described by Donald Knuth in The Art of Computer Programming, Volume 2: Seminumerical Algorithms (Addison-Wesley, 1997).

System.Random is not cryptographically secure and should not be used for any applications where predictability can pose a threat.

The
RNGCryptoServiceProvider class in the System.Security.Cryptography namespace is, however, a cryptographically secure random number generator and can be used in situations where cryptographically strong random values are required.

No comments: