mirror of https://github.com/status-im/bip39.git
index: rename mnemonicToSeed to mnemonicToSeedHex
This commit is contained in:
parent
713e5c107d
commit
8272cb62f6
4
index.js
4
index.js
|
@ -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
|
||||
|
|
|
@ -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])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue