index: rename mnemonicToSeed to mnemonicToSeedHex

This commit is contained in:
Daniel Cousens 2014-08-17 10:38:11 +10:00
parent 713e5c107d
commit 8272cb62f6
2 changed files with 4 additions and 4 deletions

View File

@ -4,7 +4,7 @@ var secureRandom = require('secure-random')
var DEFAULT_WORDLIST = require('./wordlists/en.json')
function mnemonicToSeed(mnemonic, password) {
function mnemonicToSeedHex(mnemonic, password) {
var options = { iterations: 2048, hasher: CryptoJS.algo.SHA512, keySize: 512/32 }
return CryptoJS.PBKDF2(mnemonic, salt(password), options).toString(CryptoJS.enc.Hex)
}
@ -102,7 +102,7 @@ function lpad(str, padString, length) {
}
module.exports = {
mnemonicToSeed: mnemonicToSeed,
mnemonicToSeedHex: mnemonicToSeedHex,
entropyToMnemonic: entropyToMnemonic,
generateMnemonic: generateMnemonic,
validateMnemonic: validateMnemonic

View File

@ -9,12 +9,12 @@ var wordlists = {
var vectors = require('./vectors.json')
describe('BIP39', function() {
describe('mnemonicToSeed', function() {
describe('mnemonicToSeedHex', function() {
this.timeout(20000)
vectors.english.forEach(function(v, i) {
it('works for tests vector ' + i, function() {
assert.equal(BIP39.mnemonicToSeed(v[1], 'TREZOR'), v[2])
assert.equal(BIP39.mnemonicToSeedHex(v[1], 'TREZOR'), v[2])
})
})
})