randomness in Chrome

This commit is contained in:
Mike Hamburg 2011-07-10 16:20:58 -07:00
parent 8d3a6e7ded
commit c1fcb9a560

View file

@ -366,3 +366,13 @@ sjcl.random = {
}
};
(function(){
try {
// get cryptographically strong entropy in Webkit
var ab = new Uint32Array(32), i;
crypto.getRandomValues(ab);
sjcl.random.addEntropy(ab, 1024, "crypto.getRandomValues");
} catch (e) {
// no getRandomValues :-(
}
})();