3 ms·
Would not have happened in C# which uses distinct Random (and Random.Shared) as PRNG and RandomNumberGenerator[0] as CSPRNG even when mixing namespaces. Also h
by neonsunset 2y ago
Would not have happened in C# which uses distinct Random (and Random.Shared) as PRNG and RandomNumberGenerator[0] as CSPRNG even when mixing namespaces.
Also has corresponding analyzer rule if you want to enforce this project-wide[1].
[0] https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.randomnumbergenerator https://learn.microsoft.com/en-us/dotnet/api/system.security...
[1] https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca5394 https://learn.microsoft.com/en-us/dotnet/fundamentals/code-a...
- rsc 2y agoIf I had to guess which of Random and RandomNumberGenerator was the cryptographically secure one, I would have guessed wrong. It's not clear either way.
- onionisafruit 2y agoMaybe so, but once you know you won’t need to scroll to the top of the file to know which one you are using.