diff --git a/src/js/index.js b/src/js/index.js index 472d392..8caa0ed 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -240,7 +240,7 @@ } phraseChangeTimeoutEvent = setTimeout(function() { phraseChanged(); - var entropy = mnemonic.toRawEntropyHex(DOM.phrase.val()); + var entropy = mnemonic.toRawEntropyBin(DOM.phrase.val()); if (entropy !== null) { DOM.entropyMnemonicLength.val("raw"); DOM.entropy.val(entropy); diff --git a/src/js/jsbip39.js b/src/js/jsbip39.js index 9a6e7ec..1e52d9d 100644 --- a/src/js/jsbip39.js +++ b/src/js/jsbip39.js @@ -130,6 +130,12 @@ var Mnemonic = function(language) { return h; } + self.toRawEntropyBin = function(mnemonic) { + var b = mnemonicToBinaryString(mnemonic); + var d = b.substring(0, b.length / 33 * 32); + return d; + } + self.toSeed = function(mnemonic, passphrase) { passphrase = passphrase || ''; mnemonic = self.joinWords(self.splitWords(mnemonic)); // removes duplicate blanks diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 977294c..07918c2 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js @@ -4129,8 +4129,13 @@ fit('Converts mnemonics into raw entropy', function(done) { driver.findElement(By.css('.entropy')) .getAttribute("value") .then(function(entropy) { - expect(entropy).toBe("00000001"); - done(); + expect(entropy).toBe("00000000000000000000000000000001"); + driver.findElement(By.css('.phrase')) + .getAttribute("value") + .then(function(phrase) { + expect(phrase).toBe("abandon abandon about"); + done(); + }); }); }); });