From d6fd8ebf8667cad13392aff185fa5da7a7e82cbe Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Mon, 14 Nov 2016 13:21:04 +1100 Subject: Entropy is truncated from the left This provides greater compatibility with bip32jp.github.io --- src/js/index.js | 3 ++- tests.js | 8 +++----- 2 files changed, 5 insertions(+), 6 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 @@ } // Discard trailing entropy var bitsToUse = Math.floor(bits.length / 32) * 32; - var binaryStr = bits.substring(0, bitsToUse); + var start = bits.length - bitsToUse; + var binaryStr = bits.substring(start); // Convert entropy string to numeric array var entropyArr = []; for (var i=0; i