From: Ian Coleman Date: Mon, 14 Nov 2016 02:21:04 +0000 (+1100) Subject: Entropy is truncated from the left X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git;a=commitdiff_plain;h=d6fd8ebf8667cad13392aff185fa5da7a7e82cbe Entropy is truncated from the left This provides greater compatibility with bip32jp.github.io --- 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