From: Ian Coleman Date: Tue, 17 Dec 2019 22:07:17 +0000 (+1100) Subject: Convert mnemonic to hex entropy instead of binary X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git;a=commitdiff_plain;h=244c76022af53c1f5b337a5a2cdb70358cf85e19 Convert mnemonic to hex entropy instead of binary --- diff --git a/src/js/index.js b/src/js/index.js index 3db0a31..c9e7b44 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -239,10 +239,12 @@ } phraseChangeTimeoutEvent = setTimeout(function() { phraseChanged(); - var entropy = mnemonic.toRawEntropyBin(DOM.phrase.val()); + var entropy = mnemonic.toRawEntropyHex(DOM.phrase.val()); if (entropy !== null) { DOM.entropyMnemonicLength.val("raw"); DOM.entropy.val(entropy); + DOM.entropyTypeInputs.filter("[value='hexadecimal']").prop("checked", true); + entropyTypeAutoDetect = false; } }, 400); } diff --git a/tests/spec/tests.js b/tests/spec/tests.js index bdc5909..fefb8b7 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js @@ -4243,7 +4243,7 @@ it('Converts mnemonics into raw entropy', function(done) { driver.findElement(By.css('.entropy')) .getAttribute("value") .then(function(entropy) { - expect(entropy).toBe("00000000000000000000000000000001"); + expect(entropy).toBe("00000001"); driver.findElement(By.css('.phrase')) .getAttribute("value") .then(function(phrase) {