Each new instance of CryptoRandom replaces the static generator.
sloncho opened this issue · 2 comments
sloncho commented
nanoid-net/src/Nanoid/CryptoRandom.cs
Line 19 in 445f4d3
Not sure if this is a problem or not, but looks like it can have negative consequences. The CryptoRandom is used as singleton in NanoId static class, but as CryptoRandom is public, the consumer can create new instances, which in term will replace the static _r
member, this changing the behavior of the instance used in Nanoid static methods.
Suggestion: make _r
instance, and not static field. Or use static initializer on L19 instead of constructor initializer.
codeyu commented
thank you. v3.1.0 released.