-
-
Notifications
You must be signed in to change notification settings - Fork 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
Math.random on V8 not random enough #57
Comments
As far as I know, JSEncrypt already uses JSEncrypt uses JSBN behind the scenes, and that has a PRNG that first tries https://github.com/travist/jsencrypt/blob/master/lib/jsbn/rng.js |
@jalada exactly, thank you :) (closing now) |
I'm afraid I didn't check the code well enough. Sorry for wasting your time. |
Not a problem @pmontrasio, I actually came here to double check JSEncrypt because of the same blog post. |
@pmontrasio & @jalada P.S. kudos to @ctso for his work in #6 |
I just read TIFU by using Math.random() (discussion on HN at https://news.ycombinator.com/item?id=10598065). TL;DR this is what
Math.random
yields on Firefoxand this is what it yields on V8
The author suggests using
crypto.getRandomValues
in the browser. That populates a typed array with random values. Example:https://developer.mozilla.org/en-US/docs/Web/API/RandomSource/getRandomValues
The text was updated successfully, but these errors were encountered: