jayce0071 / crypto-js

Automatically exported from code.google.com/p/crypto-js
0 stars 0 forks source link

[Patch] Use window.crypto.getRandomValues() if available #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Since some time, WebKit implements a function called 
window.crypto.getRandomValues() that generates cryptographically secure random 
values using the operating system's entropy pool. This feature is just now in 
the process of being integrated into Gecko, too:

https://bugzilla.mozilla.org/show_bug.cgi?id=440046

The attached patch checks if getRandomValues() and, if available, uses it, 
while falling back to Math.random() otherwise. I tested it on both Chromium 
(which has getRandomValues) and Firefox (which currently doesn't) and it seems 
to work fine, with the right code path being used.

Original issue reported on code.google.com by denis.a....@gmail.com on 10 Jan 2012 at 5:37

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by Jeff.Mott.OR on 26 Jan 2012 at 7:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
IE11 added this functionality, but prefixed ( window.mscrypto.getRandomValues() 
http://msdn.microsoft.com/en-us/library/ie/dn302324(v=vs.85).aspx )

Original comment by lambda...@gmail.com on 18 Aug 2014 at 4:33