Entropy is left-padded to 256 bits

Closes #49
This commit is contained in:
Ian Coleman
2017-01-12 13:47:09 +11:00
parent 40892aba50
commit 53aaab270d
3 changed files with 31 additions and 2 deletions
+1 -1
View File
@@ -843,7 +843,7 @@
var hash = sjcl.hash.sha256.hash(entropy.cleanStr);
var hex = sjcl.codec.hex.fromBits(hash);
bits = BigInteger.parse(hex, 16).toString(2);
for (var i=0; i<256-bits.length; i++) {
while (bits.length % 256 != 0) {
bits = "0" + bits;
}
// Truncate hash to suit number of words