From dc52dfe703e89de8c580e55679d9461332b94e2c Mon Sep 17 00:00:00 2001 From: onovy Date: Sun, 5 Jan 2014 20:03:34 +0100 Subject: [PATCH] More entropy. --- bitaddress.org.html | 15 +++++++++------ src/securerandom.js | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/bitaddress.org.html b/bitaddress.org.html index 59cd96b..c81fa62 100644 --- a/bitaddress.org.html +++ b/bitaddress.org.html @@ -1653,14 +1653,17 @@ if (typeof Crypto == "undefined" || !Crypto.util) { entropyStr += pluginsStr + mimeTypesStr; // cookies and storage: 1 bit entropyStr += navigator.cookieEnabled + typeof (sessionStorage) + typeof (localStorage); + // language: ~7 bit + entropyStr += navigator.language; + // history: ~2 bit + entropyStr += window.history.length; + // location + entropyStr += window.location; var entropyBytes = Crypto.SHA256(entropyStr, { asBytes: true }); - sr.seedInt8(entropyBytes[0]); - sr.seedInt8(entropyBytes[1]); - sr.seedInt8(entropyBytes[2]); - sr.seedInt8(entropyBytes[3]); - sr.seedInt8(entropyBytes[4]); - sr.seedInt8(entropyBytes[5]); + for (var i = 0 ; i < entropyBytes.length ; i++) { + sr.seedInt8(entropyBytes[i]); + } } })(); diff --git a/src/securerandom.js b/src/securerandom.js index 532e3b6..4d1d800 100644 --- a/src/securerandom.js +++ b/src/securerandom.js @@ -166,13 +166,16 @@ entropyStr += pluginsStr + mimeTypesStr; // cookies and storage: 1 bit entropyStr += navigator.cookieEnabled + typeof (sessionStorage) + typeof (localStorage); + // language: ~7 bit + entropyStr += navigator.language; + // history: ~2 bit + entropyStr += window.history.length; + // location + entropyStr += window.location; var entropyBytes = Crypto.SHA256(entropyStr, { asBytes: true }); - sr.seedInt8(entropyBytes[0]); - sr.seedInt8(entropyBytes[1]); - sr.seedInt8(entropyBytes[2]); - sr.seedInt8(entropyBytes[3]); - sr.seedInt8(entropyBytes[4]); - sr.seedInt8(entropyBytes[5]); + for (var i = 0 ; i < entropyBytes.length ; i++) { + sr.seedInt8(entropyBytes[i]); + } } })(); \ No newline at end of file