mirror of https://github.com/status-im/bip39.git
unorm in the same place
This commit is contained in:
parent
889f233bdd
commit
b7d3901adc
10
index.js
10
index.js
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue