diff options
-rw-r--r-- | src/js/index.js | 3 | ||||
-rw-r--r-- | 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 @@ | |||
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++) { |
@@ -2696,15 +2696,15 @@ page.open(url, function(status) { | |||
2696 | }); | 2696 | }); |
2697 | }, | 2697 | }, |
2698 | 2698 | ||
2699 | // Entropy is truncated from the right | 2699 | // Entropy is truncated from the left |
2700 | function() { | 2700 | function() { |
2701 | page.open(url, function(status) { | 2701 | page.open(url, function(status) { |
2702 | var expected = "abandon abandon ability"; | 2702 | var expected = "avocado zoo zone"; |
2703 | // use entropy | 2703 | // use entropy |
2704 | page.evaluate(function() { | 2704 | page.evaluate(function() { |
2705 | $(".use-entropy").prop("checked", true).trigger("change"); | 2705 | $(".use-entropy").prop("checked", true).trigger("change"); |
2706 | var entropy = "00000000 00000000 00000000 00000000"; | 2706 | var entropy = "00000000 00000000 00000000 00000000"; |
2707 | entropy += "11111111 11111111 11111111 1111"; // Missing last byte, only first 8 bytes are used | 2707 | entropy += "11111111 11111111 11111111 1111"; // Missing last byte |
2708 | $(".entropy").val(entropy).trigger("input"); | 2708 | $(".entropy").val(entropy).trigger("input"); |
2709 | }); | 2709 | }); |
2710 | // check the entropy is truncated from the right | 2710 | // check the entropy is truncated from the right |
@@ -2755,8 +2755,6 @@ page.open(url, function(status) { | |||
2755 | // https://bip32jp.github.io/english/index.html | 2755 | // https://bip32jp.github.io/english/index.html |
2756 | // NOTES: | 2756 | // NOTES: |
2757 | // Is incompatible with: | 2757 | // Is incompatible with: |
2758 | // base 6 with leading zeros | ||
2759 | // base 6 wth 12 words / 53 chars | ||
2760 | // base 20 | 2758 | // base 20 |
2761 | function() { | 2759 | function() { |
2762 | page.open(url, function(status) { | 2760 | page.open(url, function(status) { |