-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch defaultEntropy to math/rand/v2 #120
Comments
Looks like this is not a simple drop-in replacement because the new Rand does not have a Read() method (yet): |
Is the benefit purely or mostly derived from the additional entropy of the initial seed? Twice as slow, even at the level of single-digit nanoseconds, is actually potentially meaningful for this package. I'll play around with the new package, let's see. |
It's intended. It should use |
FWIW golang/go#67059 got accepted and merged, so rand.ChaCha8 will be a drop-in replacement from Go 1.23. |
I have been looking into google/uuid v7 implementation. By default, Probably, that should be the default behavior which is also inline with the aforementioned deprecation. |
defaultEntropy() uses math/rand in order to be fast by default:
Go 1.22 introduces math/rand/v2 which uses the ChaCha8Rand generator, greatly improving security with a minimal performance cost. From today's blog post:
So, requiring Go 1.22 and switching defaultEntropy to math/rand/v2 sounds like a win.
The text was updated successfully, but these errors were encountered: