aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2017-01-12 13:47:09 +1100
committerIan Coleman <coleman.ian@gmail.com>2017-01-12 13:47:09 +1100
commit53aaab270d7031a05ffe66f424529ea84534fb40 (patch)
tree836610b56c6ed5096954e7a104b9437fe6bde794 /src
parent40892aba5013cd75927f63e66492f46b2d206ec9 (diff)
downloadBIP39-53aaab270d7031a05ffe66f424529ea84534fb40.tar.gz
BIP39-53aaab270d7031a05ffe66f424529ea84534fb40.tar.zst
BIP39-53aaab270d7031a05ffe66f424529ea84534fb40.zip
Entropy is left-padded to 256 bits
Closes #49
Diffstat (limited to 'src')
-rw-r--r--src/js/index.js2
1 files changed, 1 insertions, 1 deletions
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 @@
843 var hash = sjcl.hash.sha256.hash(entropy.cleanStr); 843 var hash = sjcl.hash.sha256.hash(entropy.cleanStr);
844 var hex = sjcl.codec.hex.fromBits(hash); 844 var hex = sjcl.codec.hex.fromBits(hash);
845 bits = BigInteger.parse(hex, 16).toString(2); 845 bits = BigInteger.parse(hex, 16).toString(2);
846 for (var i=0; i<256-bits.length; i++) { 846 while (bits.length % 256 != 0) {
847 bits = "0" + bits; 847 bits = "0" + bits;
848 } 848 }
849 // Truncate hash to suit number of words 849 // Truncate hash to suit number of words