Merge pull request #53 from onovy/more-entropy

Just more entropy
This commit is contained in:
pointbiz 2014-01-08 20:22:04 -08:00
commit 429d77b864
2 changed files with 18 additions and 12 deletions

View file

@ -1653,14 +1653,17 @@ if (typeof Crypto == "undefined" || !Crypto.util) {
entropyStr += pluginsStr + mimeTypesStr; entropyStr += pluginsStr + mimeTypesStr;
// cookies and storage: 1 bit // cookies and storage: 1 bit
entropyStr += navigator.cookieEnabled + typeof (sessionStorage) + typeof (localStorage); 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 }); var entropyBytes = Crypto.SHA256(entropyStr, { asBytes: true });
sr.seedInt8(entropyBytes[0]); for (var i = 0 ; i < entropyBytes.length ; i++) {
sr.seedInt8(entropyBytes[1]); sr.seedInt8(entropyBytes[i]);
sr.seedInt8(entropyBytes[2]); }
sr.seedInt8(entropyBytes[3]);
sr.seedInt8(entropyBytes[4]);
sr.seedInt8(entropyBytes[5]);
} }
})(); })();
</script> </script>

View file

@ -166,13 +166,16 @@
entropyStr += pluginsStr + mimeTypesStr; entropyStr += pluginsStr + mimeTypesStr;
// cookies and storage: 1 bit // cookies and storage: 1 bit
entropyStr += navigator.cookieEnabled + typeof (sessionStorage) + typeof (localStorage); 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 }); var entropyBytes = Crypto.SHA256(entropyStr, { asBytes: true });
sr.seedInt8(entropyBytes[0]); for (var i = 0 ; i < entropyBytes.length ; i++) {
sr.seedInt8(entropyBytes[1]); sr.seedInt8(entropyBytes[i]);
sr.seedInt8(entropyBytes[2]); }
sr.seedInt8(entropyBytes[3]);
sr.seedInt8(entropyBytes[4]);
sr.seedInt8(entropyBytes[5]);
} }
})(); })();