aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2016-11-14 13:21:04 +1100
committerIan Coleman <coleman.ian@gmail.com>2016-11-14 13:21:04 +1100
commitd6fd8ebf8667cad13392aff185fa5da7a7e82cbe (patch)
tree167cf981efd0e033d484b13425687d1a350fd15c /src
parentdd944906560fd6974202c338e5350853c5ce2dc7 (diff)
downloadBIP39-d6fd8ebf8667cad13392aff185fa5da7a7e82cbe.tar.gz
BIP39-d6fd8ebf8667cad13392aff185fa5da7a7e82cbe.tar.zst
BIP39-d6fd8ebf8667cad13392aff185fa5da7a7e82cbe.zip
Entropy is truncated from the left
This provides greater compatibility with bip32jp.github.io
Diffstat (limited to 'src')
-rw-r--r--src/js/index.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/js/index.js b/src/js/index.js
index d356eb8..b03f2c8 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -764,7 +764,8 @@
764 } 764 }
765 // Discard trailing entropy 765 // Discard trailing entropy
766 var bitsToUse = Math.floor(bits.length / 32) * 32; 766 var bitsToUse = Math.floor(bits.length / 32) * 32;
767 var binaryStr = bits.substring(0, bitsToUse); 767 var start = bits.length - bitsToUse;
768 var binaryStr = bits.substring(start);
768 // Convert entropy string to numeric array 769 // Convert entropy string to numeric array
769 var entropyArr = []; 770 var entropyArr = [];
770 for (var i=0; i<binaryStr.length / 8; i++) { 771 for (var i=0; i<binaryStr.length / 8; i++) {