Re-ordered some parameters, fixed typo.

This commit is contained in:
ricmoo 2016-08-01 14:14:53 -04:00
parent 5e421d2636
commit 024cc1806f

@ -237,7 +237,7 @@ utils.defineProperty(secretStorage, 'encrypt', function(privateKey, password, op
// Check the password
if (!Buffer.isBuffer(password)) { throw new Error('password must be a buffer'); }
// Check/generate the DAO
// Check/generate the salt
var salt = options.salt;
if (salt) {
salt = utils.hexOrBuffer(salt, 'salt');
@ -260,11 +260,11 @@ utils.defineProperty(secretStorage, 'encrypt', function(privateKey, password, op
}
// Override the scrypt password-based key derivation function parameters
var N = (1 << 17), p = 1, r = 8;
var N = (1 << 17), r = 8, p = 1;
if (options.scrypt) {
if (options.scrypt.N) { N = options.scrypt.N; }
if (options.scrypt.p) { p = options.scrypt.p; }
if (options.scrypt.r) { r = options.scrypt.r; }
if (options.scrypt.p) { p = options.scrypt.p; }
}
// We take 64 bytes: