summaryrefslogtreecommitdiff
path: root/lib/crypto.js
diff options
context:
space:
mode:
authorTom Gallacher <tomgallacher23@gmail.com>2015-11-27 10:41:38 +0000
committerShigeki Ohtsu <ohtsu@iij.ad.jp>2016-01-23 02:26:28 +0900
commita1163582c53dc6e00f3680084269600913b1cad2 (patch)
tree88464455916d5fa61731c49cadbe9e2af498e458 /lib/crypto.js
parentdb9e122182f7e605eba2eb2e9ddea0bf00bb572c (diff)
downloadandroid-node-v8-a1163582c53dc6e00f3680084269600913b1cad2.tar.gz
android-node-v8-a1163582c53dc6e00f3680084269600913b1cad2.tar.bz2
android-node-v8-a1163582c53dc6e00f3680084269600913b1cad2.zip
crypto: pbkdf2 deprecate digest overload.
As per #3292, this PR introduces a deprecation notice about removing the 'default digest' overload which currently defaults to the soon to be defunct SHA1 digest. Instead it should be left up to the documentation and implementor to suggest a suitable digest function. Ref: https://github.com/nodejs/node/pull/3292 PR-URL: https://github.com/nodejs/node/pull/4047 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
Diffstat (limited to 'lib/crypto.js')
-rw-r--r--lib/crypto.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/crypto.js b/lib/crypto.js
index bed7d7764e..4b0539406e 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -531,6 +531,11 @@ ECDH.prototype.getPublicKey = function getPublicKey(encoding, format) {
};
+const pbkdf2DeprecationWarning =
+ internalUtil.deprecate(() => {}, 'crypto.pbkdf2 without specifying' +
+ ' a digest is deprecated. Please specify a digest');
+
+
exports.pbkdf2 = function(password,
salt,
iterations,
@@ -540,6 +545,7 @@ exports.pbkdf2 = function(password,
if (typeof digest === 'function') {
callback = digest;
digest = undefined;
+ pbkdf2DeprecationWarning();
}
if (typeof callback !== 'function')
@@ -550,6 +556,10 @@ exports.pbkdf2 = function(password,
exports.pbkdf2Sync = function(password, salt, iterations, keylen, digest) {
+ if (typeof digest === 'undefined') {
+ digest = undefined;
+ pbkdf2DeprecationWarning();
+ }
return pbkdf2(password, salt, iterations, keylen, digest);
};