mirror of
https://github.com/ok2/coinbin.git
synced 2026-05-09 18:15:23 +02:00
Capture mouse movements for entropy
This commit is contained in:
@@ -813,4 +813,30 @@ $(document).ready(function() {
|
||||
$("#newKeysBtn").click();
|
||||
|
||||
validateOutputAmount();
|
||||
|
||||
/* capture mouse movement to add entropy */
|
||||
var IE = document.all?true:false // Boolean, is browser IE?
|
||||
if (!IE) document.captureEvents(Event.MOUSEMOVE)
|
||||
document.onmousemove = getMouseXY;
|
||||
function getMouseXY(e) {
|
||||
var tempX = 0;
|
||||
var tempY = 0;
|
||||
if (IE) { // If browser is IE
|
||||
tempX = event.clientX + document.body.scrollLeft;
|
||||
tempY = event.clientY + document.body.scrollTop;
|
||||
} else {
|
||||
tempX = e.pageX;
|
||||
tempY = e.pageY;
|
||||
};
|
||||
if (tempX < 0){tempX = 0};
|
||||
if (tempY < 0){tempY = 0};
|
||||
var xEnt = Crypto.util.bytesToHex([tempX]);
|
||||
var yEnt = Crypto.util.bytesToHex([tempY]);
|
||||
var addEnt = xEnt.concat(yEnt);
|
||||
if ($("#entropybucket").html().indexOf(xEnt) == -1 && $("#entropybucket").html().indexOf(yEnt) == -1) {
|
||||
$("#entropybucket").html(addEnt + $("#entropybucket").html());
|
||||
};
|
||||
if ($("#entropybucket").html().length > 128) {$("#entropybucket").html($("#entropybucket").html().slice(0, 128))};
|
||||
return true;
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user