unorm in the same place

This commit is contained in:
Daniel Cousens 2015-10-02 00:35:03 +10:00
parent 889f233bdd
commit b7d3901adc
1 changed files with 5 additions and 5 deletions

View File

@ -9,9 +9,13 @@ var unorm = require('unorm')
var DEFAULT_WORDLIST = require('./wordlists/en.json')
var JAPANESE_WORDLIST = require('./wordlists/ja.json')
function salt (password) {
return 'mnemonic' + (password || '')
}
function mnemonicToSeed (mnemonic, password) {
var mnemonicBuffer = new Buffer(unorm.nfkd(mnemonic), 'utf8')
var saltBuffer = new Buffer(salt(password), 'utf8')
var saltBuffer = new Buffer(salt(unorm.nfkd(password)), 'utf8')
return pbkdf2(mnemonicBuffer, saltBuffer, 2048, 64, 'sha512')
}
@ -102,10 +106,6 @@ function checksumBits (entropyBuffer) {
return bytesToBinary([].slice.call(hash)).slice(0, CS)
}
function salt (password) {
return 'mnemonic' + (unorm.nfkd(password) || '')
}
// =========== helper methods from bitcoinjs-lib ========
function bytesToBinary (bytes) {