Skip to content
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

Use better methods for generating entropy #6

Merged
merged 3 commits into from
Aug 22, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Initialize Uint32Array before getRandomValues
This seems to cause PhantomJS to fail, as getRandomValues does not
return the array.
  • Loading branch information
ctso committed Aug 20, 2013
commit c3be58aea26a271b640b43c4f72861ea6fafd80b
3 changes: 2 additions & 1 deletion jsbn/rng.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ if(rng_pool == null) {
var t;
if(window.crypto && window.crypto.getRandomValues) {
// Extract entropy (2048 bits) from RNG if available
var z = window.crypto.getRandomValues(new Uint32Array(256));
var z = new Uint32Array(256);
window.crypto.getRandomValues(z);
for (t = 0; t < z.length; ++t)
rng_pool[rng_pptr++] = z[t] & 255;
}
Expand Down