-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
crypto: add random big integer generation #22266
base: master
Are you sure you want to change the base?
crypto: add random big integer generation #22266
Conversation
vlib/crypto/rand/utils.v
Outdated
if len == 0 { | ||
// max must be 0 | ||
return max | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems weird. Why return a definite number, from a function that is said to return a random one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a little more explanation in the comment.
If the user-given max is 1, the only valid integer in [0, 1) is 0. So 0 is returned early.
I think allowing users to give 1 as max is ok.
The vab failure is unrelated, and now fixed on master. |
Addresses #22206