|
@ -458,6 +458,19 @@ DiffieHellman.prototype.setPrivateKey = function(key, encoding) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.pbkdf2 = function(password, salt, iterations, keylen, callback) { |
|
|
exports.pbkdf2 = function(password, salt, iterations, keylen, callback) { |
|
|
|
|
|
if (typeof callback !== 'function') |
|
|
|
|
|
throw new Error('No callback provided to pbkdf2'); |
|
|
|
|
|
|
|
|
|
|
|
return pbkdf2(password, salt, iterations, keylen, callback); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.pbkdf2Sync = function(password, salt, iterations, keylen) { |
|
|
|
|
|
return pbkdf2(password, salt, iterations, keylen); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function pbkdf2(password, salt, iterations, keylen, callback) { |
|
|
password = toBuf(password); |
|
|
password = toBuf(password); |
|
|
salt = toBuf(salt); |
|
|
salt = toBuf(salt); |
|
|
|
|
|
|
|
@ -476,11 +489,8 @@ exports.pbkdf2 = function(password, salt, iterations, keylen, callback) { |
|
|
var ret = binding.PBKDF2(password, salt, iterations, keylen); |
|
|
var ret = binding.PBKDF2(password, salt, iterations, keylen); |
|
|
return ret.toString(encoding); |
|
|
return ret.toString(encoding); |
|
|
} |
|
|
} |
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
exports.pbkdf2Sync = function(password, salt, iterations, keylen) { |
|
|
|
|
|
return exports.pbkdf2(password, salt, iterations, keylen); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.randomBytes = randomBytes; |
|
|
exports.randomBytes = randomBytes; |
|
|