Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 25220f0

Browse filesBrowse files
MaleDongtargos
authored andcommitted
lib,doc: remove unused parameter, improve docs
1) Remove 'callback' in 'check' function, because we don't check or use that directly. 2) Make 'digest' clearer in the documentation. PR-URL: #22858 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 5660759 commit 25220f0
Copy full SHA for 25220f0

File tree

Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed
Open diff view settings
Collapse file

‎doc/api/crypto.md‎

Copy file name to clipboardExpand all lines: doc/api/crypto.md
+6Lines changed: 6 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,9 @@ otherwise `err` will be `null`. By default, the successfully generated
18081808
`derivedKey` will be passed to the callback as a [`Buffer`][]. An error will be
18091809
thrown if any of the input arguments specify invalid values or types.
18101810

1811+
If `digest` is `null`, `'sha1'` will be used. This behavior will be deprecated
1812+
in a future version of Node.js.
1813+
18111814
The `iterations` argument must be a number set as high as possible. The
18121815
higher the number of iterations, the more secure the derived key will be,
18131816
but will take a longer amount of time to complete.
@@ -1871,6 +1874,9 @@ applied to derive a key of the requested byte length (`keylen`) from the
18711874
If an error occurs an `Error` will be thrown, otherwise the derived key will be
18721875
returned as a [`Buffer`][].
18731876

1877+
If `digest` is `null`, `'sha1'` will be used. This behavior will be deprecated
1878+
in a future version of Node.js.
1879+
18741880
The `iterations` argument must be a number set as high as possible. The
18751881
higher the number of iterations, the more secure the derived key will be,
18761882
but will take a longer amount of time to complete.
Collapse file

‎lib/internal/crypto/pbkdf2.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/pbkdf2.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function pbkdf2(password, salt, iterations, keylen, digest, callback) {
2222
}
2323

2424
({ password, salt, iterations, keylen, digest } =
25-
check(password, salt, iterations, keylen, digest, callback));
25+
check(password, salt, iterations, keylen, digest));
2626

2727
if (typeof callback !== 'function')
2828
throw new ERR_INVALID_CALLBACK();
@@ -42,15 +42,15 @@ function pbkdf2(password, salt, iterations, keylen, digest, callback) {
4242

4343
function pbkdf2Sync(password, salt, iterations, keylen, digest) {
4444
({ password, salt, iterations, keylen, digest } =
45-
check(password, salt, iterations, keylen, digest, pbkdf2Sync));
45+
check(password, salt, iterations, keylen, digest));
4646
const keybuf = Buffer.alloc(keylen);
4747
handleError(keybuf, password, salt, iterations, digest);
4848
const encoding = getDefaultEncoding();
4949
if (encoding === 'buffer') return keybuf;
5050
return keybuf.toString(encoding);
5151
}
5252

53-
function check(password, salt, iterations, keylen, digest, callback) {
53+
function check(password, salt, iterations, keylen, digest) {
5454
if (typeof digest !== 'string') {
5555
if (digest !== null)
5656
throw new ERR_INVALID_ARG_TYPE('digest', ['string', 'null'], digest);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.