SecureRandom: /!\ throw an alert if the PRNG is used is initialized when the entropy collection using the mouse is not done.
This commit is contained in:
parent
125d9d8997
commit
5b3cae1f32
3 changed files with 23 additions and 5 deletions
|
@ -1543,6 +1543,11 @@ if (typeof Crypto == "undefined" || !Crypto.util) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sr.getByte = function () {
|
sr.getByte = function () {
|
||||||
|
if(!ninja.seeder.isDone()) {
|
||||||
|
alert("Premature initialisation of the random generator. Something is really wrong, do not generate wallets.");
|
||||||
|
return NaN;
|
||||||
|
}
|
||||||
|
|
||||||
if (sr.state == null) {
|
if (sr.state == null) {
|
||||||
sr.seedTime();
|
sr.seedTime();
|
||||||
sr.state = sr.ArcFour(); // Plug in your RNG constructor here
|
sr.state = sr.ArcFour(); // Plug in your RNG constructor here
|
||||||
|
@ -10703,6 +10708,10 @@ ninja.publicKey = {
|
||||||
lastInputTime: new Date().getTime(),
|
lastInputTime: new Date().getTime(),
|
||||||
seedPoints: [],
|
seedPoints: [],
|
||||||
|
|
||||||
|
isDone: function() {
|
||||||
|
return ninja.seeder.seedCount >= ninja.seeder.seedLimit;
|
||||||
|
},
|
||||||
|
|
||||||
// seed function exists to wait for mouse movement to add more entropy before generating an address
|
// seed function exists to wait for mouse movement to add more entropy before generating an address
|
||||||
seed: function (evt) {
|
seed: function (evt) {
|
||||||
if (!evt) var evt = window.event;
|
if (!evt) var evt = window.event;
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
lastInputTime: new Date().getTime(),
|
lastInputTime: new Date().getTime(),
|
||||||
seedPoints: [],
|
seedPoints: [],
|
||||||
|
|
||||||
|
isDone: function() {
|
||||||
|
return ninja.seeder.seedCount >= ninja.seeder.seedLimit;
|
||||||
|
},
|
||||||
|
|
||||||
// seed function exists to wait for mouse movement to add more entropy before generating an address
|
// seed function exists to wait for mouse movement to add more entropy before generating an address
|
||||||
seed: function (evt) {
|
seed: function (evt) {
|
||||||
if (!evt) var evt = window.event;
|
if (!evt) var evt = window.event;
|
||||||
|
|
|
@ -52,6 +52,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
sr.getByte = function () {
|
sr.getByte = function () {
|
||||||
|
if(!ninja.seeder.isDone()) {
|
||||||
|
alert("Premature initialisation of the random generator. Something is really wrong, do not generate wallets.");
|
||||||
|
return NaN;
|
||||||
|
}
|
||||||
|
|
||||||
if (sr.state == null) {
|
if (sr.state == null) {
|
||||||
sr.seedTime();
|
sr.seedTime();
|
||||||
sr.state = sr.ArcFour(); // Plug in your RNG constructor here
|
sr.state = sr.ArcFour(); // Plug in your RNG constructor here
|
||||||
|
|
Loading…
Add table
Reference in a new issue