From 88385fe8b9994030e72c5c9b11f4ae380ba41c34 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 15 Feb 2017 20:25:56 +0100 Subject: [PATCH] examples: fix pbkdf2 invocation Calling `crypto.pbkdf2()` without a digest has been deprecated in Node and is scheduled to be broken in Node 8. Fix this by actually passing a digest. ref: https://github.com/nodejs/node/pull/11305 --- examples/auth/pass.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/auth/pass.js b/examples/auth/pass.js index fefb25b66a..d090b13c0b 100644 --- a/examples/auth/pass.js +++ b/examples/auth/pass.js @@ -31,7 +31,7 @@ var iterations = 12000; exports.hash = function (pwd, salt, fn) { if (3 == arguments.length) { - crypto.pbkdf2(pwd, salt, iterations, len, function(err, hash){ + crypto.pbkdf2(pwd, salt, iterations, len, 'sha256', function(err, hash){ fn(err, hash.toString('base64')); }); } else { @@ -39,7 +39,7 @@ exports.hash = function (pwd, salt, fn) { crypto.randomBytes(len, function(err, salt){ if (err) return fn(err); salt = salt.toString('base64'); - crypto.pbkdf2(pwd, salt, iterations, len, function(err, hash){ + crypto.pbkdf2(pwd, salt, iterations, len, 'sha256', function(err, hash){ if (err) return fn(err); fn(null, salt, hash.toString('base64')); });