-
Notifications
You must be signed in to change notification settings - Fork 56
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
Is there a reason random()
and random_mod()
require CryptoRng
?
#137
Comments
Just generally, per the What's the use case where e.g. |
Perhaps it is sufficient, my point was that it is a misuse of the marker trait. |
When are you generating a random integer with this library where it’s a nonsecret value? I suppose there are a handful of applications (e.g. batch verification)
It’s definitely more than just that. It’s intended to have a misuse resistant API which includes constant-time-by-default behavior. If there’s a good real-world use case for nonsecret integers we can consider removing the bound, but IMO the main use case for a random integer with this library is generating cryptographic secrets |
One example is testing. Or a challenge value for some ZK proof (although you can argue that you'd still want a CryptoRng there). Or some Monte-Carlo algorithm running in a large integer space (who knows). In general, I'm just not excluding a possibility that someone at some point might want a non-cryptographic random, and we shouldn't put artificial restrictions on it.
Fair enough, although it is also a bit of an annoyance to cast |
I would argue that it's the user's decision whether they want a cryptographically safe RNG used or not; there can be applications which do not require that restriction, and
CryptoRng
is just a marker trait and does not provide any additional functionality.The text was updated successfully, but these errors were encountered: