From c1fcb9a5609c4769beaa1acb174a44619a61a1c8 Mon Sep 17 00:00:00 2001 From: Mike Hamburg Date: Sun, 10 Jul 2011 16:20:58 -0700 Subject: [PATCH] randomness in Chrome --- core/random.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/random.js b/core/random.js index 2a6f135..6ae049f 100644 --- a/core/random.js +++ b/core/random.js @@ -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 :-( + } +})();