mirror of
https://github.com/OutCast3k/coinbin.git
synced 2025-12-30 21:54:10 +01:00
Merge 308c0d5470b4baa1696c8f25d012a9a58344c908 into cda4559cfd5948dbb18dc078c48a3e62121218e5
This commit is contained in:
commit
4a954ae4e5
@ -90,6 +90,7 @@
|
||||
<div id="content" class="container">
|
||||
|
||||
<noscript class="alert alert-danger center-block"><span class="glyphicon glyphicon-exclamation-sign"></span> This page uses javascript, please enable it to continue!</noscript>
|
||||
<div id="cryptoRandomStatus" class="alert alert-danger center-block hidden"><span class="glyphicon glyphicon-exclamation-sign"></span> This browser does not have a secure random number generator! Please use at your own risk!</div>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane tab-content active" id="home">
|
||||
|
||||
18
js/coin.js
18
js/coin.js
@ -42,9 +42,27 @@
|
||||
};
|
||||
}
|
||||
|
||||
/* generate crypto secure random numbers (should exist on most browsers) */
|
||||
coinjs.randomBytesSafe = function(count){
|
||||
var cry = window.crypto || window.msCrypto;
|
||||
if (!cry) {
|
||||
/* Display warning message for 30 seconds */
|
||||
document.getElementById('cryptoRandomStatus').classList.remove("hidden");
|
||||
setTimeout(function(){
|
||||
document.getElementById('cryptoRandomStatus').classList.add("hidden");
|
||||
}, 30000);
|
||||
|
||||
return '';
|
||||
}
|
||||
var buf = new Uint8Array(count);
|
||||
cry.getRandomValues(buf);
|
||||
return Crypto.util.bytesToHex(buf);
|
||||
}
|
||||
|
||||
/* generate a new random private key */
|
||||
coinjs.newPrivkey = function(){
|
||||
var x = window.location;
|
||||
x += coinjs.randomBytesSafe(32);
|
||||
x += (window.screen.height * window.screen.width * window.screen.colorDepth);
|
||||
x += coinjs.random(64);
|
||||
x += (window.screen.availHeight * window.screen.availWidth * window.screen.pixelDepth);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user