June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to generate a random number that can’t be reverse-engineered (or predicted) by a malicious user.
Use the RNGCryptoServiceProvider class in the System.Security.Cryptography namespace instead of the System.Random class.
Computers are designed to be deterministic. As a result, they aren’t often a good source of random numbers. The numbers you generate with the System.Random class are statistically random, which means that they follow a random distribution and are suitable for modeling, simulations, computer games, and so on. However, these generators aren’t suitable for cryptographic purposes. With knowledge of the algorithm, a malicious user can look at the random numbers you generate, ...
Read now
Unlock full access