diff options
Diffstat (limited to 'src/js/jsbip39.js')
-rw-r--r-- | src/js/jsbip39.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/js/jsbip39.js b/src/js/jsbip39.js index 67ba5a7..025f625 100644 --- a/src/js/jsbip39.js +++ b/src/js/jsbip39.js | |||
@@ -130,10 +130,11 @@ var Mnemonic = function(language) { | |||
130 | 130 | ||
131 | self.toSeed = function(mnemonic, passphrase) { | 131 | self.toSeed = function(mnemonic, passphrase) { |
132 | passphrase = passphrase || ''; | 132 | passphrase = passphrase || ''; |
133 | mnemonic = self.joinWords(self.splitWords(self.normalizeString(mnemonic))); // removes blanks | 133 | mnemonic = self.joinWords(self.splitWords(mnemonic)); // removes duplicate blanks |
134 | var mnemonicNormalized = self.normalizeString(mnemonic); | ||
134 | passphrase = self.normalizeString(passphrase) | 135 | passphrase = self.normalizeString(passphrase) |
135 | passphrase = "mnemonic" + passphrase; | 136 | passphrase = "mnemonic" + passphrase; |
136 | var mnemonicBits = sjcl.codec.utf8String.toBits(mnemonic); | 137 | var mnemonicBits = sjcl.codec.utf8String.toBits(mnemonicNormalized); |
137 | var passphraseBits = sjcl.codec.utf8String.toBits(passphrase); | 138 | var passphraseBits = sjcl.codec.utf8String.toBits(passphrase); |
138 | var result = sjcl.misc.pbkdf2(mnemonicBits, passphraseBits, PBKDF2_ROUNDS, 512, hmacSHA512); | 139 | var result = sjcl.misc.pbkdf2(mnemonicBits, passphraseBits, PBKDF2_ROUNDS, 512, hmacSHA512); |
139 | var hashHex = sjcl.codec.hex.fromBits(result); | 140 | var hashHex = sjcl.codec.hex.fromBits(result); |