Skip to content

Commit e9c6ee7

Browse files
tniessentargos
authored andcommitted
crypto: remove default encoding from pbkdf2
Refs: #47182 PR-URL: #47869 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 93f1aa2 commit e9c6ee7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/internal/crypto/pbkdf2.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const {
2020

2121
const {
2222
getArrayBufferOrView,
23-
getDefaultEncoding,
2423
normalizeHashName,
2524
kKeyObject,
2625
} = require('internal/crypto/util');
@@ -49,14 +48,11 @@ function pbkdf2(password, salt, iterations, keylen, digest, callback) {
4948
keylen,
5049
digest);
5150

52-
const encoding = getDefaultEncoding();
5351
job.ondone = (err, result) => {
5452
if (err !== undefined)
5553
return FunctionPrototypeCall(callback, job, err);
5654
const buf = Buffer.from(result);
57-
if (encoding === 'buffer')
58-
return FunctionPrototypeCall(callback, job, null, buf);
59-
FunctionPrototypeCall(callback, job, null, buf.toString(encoding));
55+
return FunctionPrototypeCall(callback, job, null, buf);
6056
};
6157

6258
job.run();
@@ -78,9 +74,7 @@ function pbkdf2Sync(password, salt, iterations, keylen, digest) {
7874
if (err !== undefined)
7975
throw err;
8076

81-
const buf = Buffer.from(result);
82-
const encoding = getDefaultEncoding();
83-
return encoding === 'buffer' ? buf : buf.toString(encoding);
77+
return Buffer.from(result);
8478
}
8579

8680
function check(password, salt, iterations, keylen, digest) {

0 commit comments

Comments
 (0)