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 def96ae

Browse filesBrowse files
danbevtargos
authored andcommitted
crypto: move _scrypt call out of handleError funct
This commit moves the _scrypt function call out of the handleError function, which now only takes in an error object as its parameter. The motivation for this is to hopefully improve readability as it was not clear to me the first time I stepped through the code where the actual call to _scrypt was. PR-URL: #28318 Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ed8cee6 commit def96ae
Copy full SHA for def96ae

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎lib/internal/crypto/scrypt.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/scrypt.js
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,21 @@ function scrypt(password, salt, keylen, options, callback = defaults) {
4444
callback.call(wrap, null, keybuf.toString(encoding));
4545
};
4646

47-
handleError(keybuf, password, salt, N, r, p, maxmem, wrap);
47+
handleError(_scrypt(keybuf, password, salt, N, r, p, maxmem, wrap));
4848
}
4949

5050
function scryptSync(password, salt, keylen, options = defaults) {
5151
options = check(password, salt, keylen, options);
5252
const { N, r, p, maxmem } = options;
5353
({ password, salt, keylen } = options);
5454
const keybuf = Buffer.alloc(keylen);
55-
handleError(keybuf, password, salt, N, r, p, maxmem);
55+
handleError(_scrypt(keybuf, password, salt, N, r, p, maxmem));
5656
const encoding = getDefaultEncoding();
5757
if (encoding === 'buffer') return keybuf;
5858
return keybuf.toString(encoding);
5959
}
6060

61-
function handleError(keybuf, password, salt, N, r, p, maxmem, wrap) {
62-
const ex = _scrypt(keybuf, password, salt, N, r, p, maxmem, wrap);
63-
61+
function handleError(ex) {
6462
if (ex === undefined)
6563
return;
6664

0 commit comments

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