mirror of
https://github.com/OutCast3k/coinbin.git
synced 2025-01-23 02:16:18 +01:00
couple of changes in the way private keys are create to support IE
This commit is contained in:
parent
e9417af10c
commit
ccee67298d
38
js/coin.js
38
js/coin.js
@ -40,15 +40,26 @@
|
|||||||
|
|
||||||
/* generate a new random private key */
|
/* generate a new random private key */
|
||||||
coinjs.newPrivkey = function(){
|
coinjs.newPrivkey = function(){
|
||||||
var randArr = new Uint8Array(32);
|
var x = window.location;
|
||||||
window.crypto.getRandomValues(randArr);
|
x += (window.screen.height * window.screen.width * window.screen.colorDepth);
|
||||||
|
x += coinjs.random(64);
|
||||||
var privateKeyBytes = [];
|
x += (window.screen.availHeight * window.screen.availWidth * window.screen.pixelDepth);
|
||||||
for (var i = 0; i < randArr.length; ++i){
|
x += navigator.language;
|
||||||
privateKeyBytes[i] = randArr[i];
|
x += window.history.length;
|
||||||
|
x += coinjs.random(64);
|
||||||
|
x += navigator.userAgent;
|
||||||
|
x += 'coinb.in'
|
||||||
|
x += (Crypto.util.randomBytes(64)).join("");
|
||||||
|
x += x.length;
|
||||||
|
var dateObj = new Date();
|
||||||
|
x += dateObj.getTimezoneOffset();
|
||||||
|
x += coinjs.random(64);
|
||||||
|
x += x+''+x;
|
||||||
|
var r = x;
|
||||||
|
for(i=0;i<(x).length;i++){
|
||||||
|
r = Crypto.SHA256(r);
|
||||||
}
|
}
|
||||||
|
return r;
|
||||||
return Crypto.util.bytesToHex(privateKeyBytes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* generate a public key from a private key */
|
/* generate a public key from a private key */
|
||||||
@ -906,4 +917,15 @@
|
|||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
coinjs.random = function(length) {
|
||||||
|
var r = "";
|
||||||
|
var l = length || 25;
|
||||||
|
var chars = "!$%^&*()_+{}:@~?><|\./;'#][=-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||||
|
for(x=0;x<l;x++) {
|
||||||
|
r += chars.charAt(Math.floor(Math.random() * 62));
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user