Merge pull request #8 from bip32JP/ValidCheck

Add check to new privkey generation.
This commit is contained in:
OutCast3k 2014-12-31 19:12:11 +00:00
commit 2660da29e9
2 changed files with 8 additions and 2 deletions

View file

@ -60,6 +60,12 @@
for(i=0;i<(x).length/25;i++){ for(i=0;i<(x).length/25;i++){
r = Crypto.SHA256(r.concat(x)); r = Crypto.SHA256(r.concat(x));
} }
var checkrBigInt = new BigInteger(r);
var orderBigInt = new BigInteger("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
while (checkrBigInt.compareTo(orderBigInt) >= 0 || checkrBigInt.equals(BigInteger.ZERO) || checkrBigInt.equals(BigInteger.ONE)) {
r = Crypto.SHA256(r.concat(x));
checkrBigInt = new BigInteger(r);
}
return r; return r;
} }

View file

@ -830,8 +830,8 @@ $(document).ready(function() {
}; };
if (tempX < 0){tempX = 0}; if (tempX < 0){tempX = 0};
if (tempY < 0){tempY = 0}; if (tempY < 0){tempY = 0};
var xEnt = Crypto.util.bytesToHex([tempX]); var xEnt = Crypto.util.bytesToHex([tempX]).slice(-2);
var yEnt = Crypto.util.bytesToHex([tempY]); var yEnt = Crypto.util.bytesToHex([tempY]).slice(-2);
var addEnt = xEnt.concat(yEnt); var addEnt = xEnt.concat(yEnt);
if ($("#entropybucket").html().indexOf(xEnt) == -1 && $("#entropybucket").html().indexOf(yEnt) == -1) { if ($("#entropybucket").html().indexOf(xEnt) == -1 && $("#entropybucket").html().indexOf(yEnt) == -1) {
$("#entropybucket").html(addEnt + $("#entropybucket").html()); $("#entropybucket").html(addEnt + $("#entropybucket").html());