v2.7.6 increase seed pool size. show seed pool while moving mouse. add textbox for keyboard entropy. do not generate address without human added entropy. browser fingerprint entropy added to seed pool starting in a random position. whole seed pool initialized with getRandomValues.
This commit is contained in:
parent
b100c39dac
commit
76704bfce2
6 changed files with 57 additions and 57 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -24,6 +24,9 @@ body { font-family: Arial; }
|
|||
|
||||
#btcaddress, #btcprivwif, #detailaddress, #detailaddresscomp, #detailprivwif, #detailprivwifcomp { font-family: monospace; font-size: 1.25em; }
|
||||
#seedpoolarea { display: none; }
|
||||
#seedpooldisplay { font-family: monospace; font-size: 0.75em; width: 600px; padding: 10px; word-wrap: break-word; }
|
||||
#generate { font-family: monospace; font-size: 1.25em; height: 275px; text-align: left; position: relative; padding: 5px; border: 2px solid green; }
|
||||
#generate span { padding: 5px 5px 0 5px; }
|
||||
#keyarea { height: 250px; }
|
||||
#keyarea .pubaddress { float: none; display: block; padding: 0; height: auto; }
|
||||
#keyarea .label { text-decoration: none; }
|
||||
|
@ -39,8 +42,6 @@ body { font-family: Arial; }
|
|||
|
||||
#main { position: relative; text-align: center; margin: 0px auto; width: 1005px; }
|
||||
#logo { width: 578px; height: 80px; }
|
||||
#generate { font-family: monospace; font-size: 1.25em; height: 158px; text-align: left; position: relative; padding: 5px; border: 2px solid green; }
|
||||
#generate span { padding: 5px 5px 0 5px; }
|
||||
|
||||
#paperarea { min-height: 120px; display: none; }
|
||||
#paperarea .keyarea { border: 2px solid green; border-top: 0; }
|
||||
|
|
|
@ -10,11 +10,16 @@ ninja.seeder = {
|
|||
// seed function exists to wait for mouse movement to add more entropy before generating an address
|
||||
seed: function (evt) {
|
||||
if (!evt) var evt = window.event;
|
||||
|
||||
// seed a bunch (minimum seedLimit) of times based on mouse moves
|
||||
// seed a bunch (minimum seedLimit) of times
|
||||
SecureRandom.seedTime();
|
||||
// seed key press character
|
||||
if (evt.which) {
|
||||
SecureRandom.seedInt8(evt.which);
|
||||
}
|
||||
// seed mouse position X and Y
|
||||
if (evt) SecureRandom.seedInt16((evt.clientX * evt.clientY));
|
||||
else if (evt) {
|
||||
SecureRandom.seedInt16((evt.clientX * evt.clientY));
|
||||
}
|
||||
|
||||
ninja.seeder.seedCount++;
|
||||
// seeding is over now we generate and display the address
|
||||
|
@ -24,23 +29,18 @@ ninja.seeder = {
|
|||
document.getElementById("generate").style.display = "none";
|
||||
document.getElementById("menu").style.visibility = "visible";
|
||||
}
|
||||
var poolHex;
|
||||
if (SecureRandom.poolCopyOnInit != null) {
|
||||
var poolHex = Crypto.util.bytesToHex(SecureRandom.poolCopyOnInit);
|
||||
document.getElementById("seedpool").innerHTML = Crypto.util.bytesToHex(SecureRandom.poolCopyOnInit);
|
||||
document.getElementById("seedpooldisplay").innerHTML = poolHex;
|
||||
}
|
||||
else {
|
||||
document.getElementById("seedpool").innerHTML = Crypto.util.bytesToHex(SecureRandom.pool);
|
||||
}
|
||||
},
|
||||
|
||||
// If user has not moved the mouse or if they are on a mobile device
|
||||
// we will force the generation after a random period of time.
|
||||
forceGenerate: function () {
|
||||
// if the mouse has not moved enough
|
||||
if (ninja.seeder.seedCount < ninja.seeder.seedLimit) {
|
||||
SecureRandom.seedTime();
|
||||
ninja.seeder.seedCount = ninja.seeder.seedLimit - 1;
|
||||
ninja.seeder.seed();
|
||||
var poolHex = Crypto.util.bytesToHex(SecureRandom.pool);
|
||||
document.getElementById("seedpool").innerHTML = poolHex;
|
||||
document.getElementById("seedpooldisplay").innerHTML = poolHex;
|
||||
}
|
||||
document.getElementById("mousemovelimit").innerHTML = (ninja.seeder.seedLimit - ninja.seeder.seedCount);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,4 @@ if (ninja.getQueryString()["testnet"] == "true" || ninja.getQueryString()["testn
|
|||
}
|
||||
if (ninja.getQueryString()["showseedpool"] == "true" || ninja.getQueryString()["showseedpool"] == "1") {
|
||||
document.getElementById("seedpoolarea").style.display = "block";
|
||||
|
||||
}
|
||||
// if users does not move mouse after random amount of time then generate the key anyway.
|
||||
setTimeout(ninja.seeder.forceGenerate, ninja.seeder.seedLimit * 100);
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
// Pool size must be a multiple of 4 and greater than 32.
|
||||
// An array of bytes the size of the pool will be passed to init()
|
||||
sr.poolSize = 256;
|
||||
sr.poolSize = 512;
|
||||
|
||||
|
||||
// --- object methods ---
|
||||
|
@ -133,12 +133,12 @@
|
|||
sr.pool = new Array();
|
||||
sr.pptr = 0;
|
||||
var t;
|
||||
if (window.crypto && window.crypto.getRandomValues) {
|
||||
if (window.crypto && window.crypto.getRandomValues && window.Uint8Array) {
|
||||
try {
|
||||
// Use webcrypto if available
|
||||
var ua = new Uint8Array(32);
|
||||
var ua = new Uint8Array(sr.poolSize);
|
||||
window.crypto.getRandomValues(ua);
|
||||
for (t = 0; t < 32; ++t)
|
||||
for (t = 0; t < sr.poolSize; ++t)
|
||||
sr.pool[sr.pptr++] = ua[t];
|
||||
} catch (e) { alert(e); }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue