From b7d3901adc7d9ff2303fd22be032fba7f3f26856 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Fri, 2 Oct 2015 00:35:03 +1000 Subject: [PATCH] unorm in the same place --- index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 8581c32..e228ed5 100644 --- a/index.js +++ b/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) {