From 53aaab270d7031a05ffe66f424529ea84534fb40 Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Thu, 12 Jan 2017 13:47:09 +1100 Subject: Entropy is left-padded to 256 bits Closes #49 --- src/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/js/index.js b/src/js/index.js index 5318800..c3c0a4a 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -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 -- cgit v1.2.3