mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
crypto: remove default encoding from pbkdf2
Refs: https://github.com/nodejs/node/pull/47182 PR-URL: https://github.com/nodejs/node/pull/47869 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
281ef804c8
commit
6fb10cad30
1 file changed
+2
-8
@@ -20,7 +20,6 @@ const {
|
||||
|
||||
const {
|
||||
getArrayBufferOrView,
|
||||
getDefaultEncoding,
|
||||
normalizeHashName,
|
||||
kKeyObject,
|
||||
} = require('internal/crypto/util');
|
||||
@@ -49,14 +48,11 @@ function pbkdf2(password, salt, iterations, keylen, digest, callback) {
|
||||
keylen,
|
||||
digest);
|
||||
|
||||
const encoding = getDefaultEncoding();
|
||||
job.ondone = (err, result) => {
|
||||
if (err !== undefined)
|
||||
return FunctionPrototypeCall(callback, job, err);
|
||||
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();
|
||||
@@ -78,9 +74,7 @@ function pbkdf2Sync(password, salt, iterations, keylen, digest) {
|
||||
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, iterations, keylen, digest) {
|
||||
|
||||
Reference in new issue
Block a user