summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2023-05-12 02:01:48 +0200
committerGitHub <noreply@github.com>2023-05-12 00:01:48 +0000
commit2e6740171049dc6fe8b6558cffa382ac2c0c9f44 (patch)
tree2224b32a360ceb71cb5cc6ad6282b4f683a1cfee
parent6191dcf343360f2bc7dcf59ad83320296d7af023 (diff)
downloadnode-new-2e6740171049dc6fe8b6558cffa382ac2c0c9f44.tar.gz
crypto: remove default encoding from scrypt
Refs: https://github.com/nodejs/node/pull/47182 PR-URL: https://github.com/nodejs/node/pull/47943 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
-rw-r--r--lib/internal/crypto/scrypt.js10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/internal/crypto/scrypt.js b/lib/internal/crypto/scrypt.js
index b794322c27..a90d317c55 100644
--- a/lib/internal/crypto/scrypt.js
+++ b/lib/internal/crypto/scrypt.js
@@ -28,7 +28,6 @@ const {
const {
getArrayBufferOrView,
- getDefaultEncoding,
} = require('internal/crypto/util');
const defaults = {
@@ -53,14 +52,11 @@ function scrypt(password, salt, keylen, options, callback = defaults) {
const job = new ScryptJob(
kCryptoJobAsync, password, salt, N, r, p, maxmem, keylen);
- const encoding = getDefaultEncoding();
job.ondone = (error, result) => {
if (error !== undefined)
return FunctionPrototypeCall(callback, job, error);
const buf = Buffer.from(result);
- if (encoding === 'buffer')
- return FunctionPrototypeCall(callback, job, null, buf);
- FunctionPrototypeCall(callback, job, null, buf.toString(encoding));
+ return FunctionPrototypeCall(callback, job, null, buf);
};
job.run();
@@ -77,9 +73,7 @@ function scryptSync(password, salt, keylen, options = defaults) {
if (err !== undefined)
throw err;
- const buf = Buffer.from(result);
- const encoding = getDefaultEncoding();
- return encoding === 'buffer' ? buf : buf.toString(encoding);
+ return Buffer.from(result);
}
function check(password, salt, keylen, options) {