GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — crypto: remove default encoding from scrypt · nodejs/node@d799347

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/crypto
    • scrypt.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/crypto/scrypt.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/scrypt.js
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const {
2828

2929
const {
3030
getArrayBufferOrView,
31-
getDefaultEncoding,
3231
} = require('internal/crypto/util');
3332

3433
const defaults = {
@@ -53,14 +52,11 @@ function scrypt(password, salt, keylen, options, callback = defaults) {
5352
const job = new ScryptJob(
5453
kCryptoJobAsync, password, salt, N, r, p, maxmem, keylen);
5554

56-
const encoding = getDefaultEncoding();
5755
job.ondone = (error, result) => {
5856
if (error !== undefined)
5957
return FunctionPrototypeCall(callback, job, error);
6058
const buf = Buffer.from(result);
61-
if (encoding === 'buffer')
62-
return FunctionPrototypeCall(callback, job, null, buf);
63-
FunctionPrototypeCall(callback, job, null, buf.toString(encoding));
59+
return FunctionPrototypeCall(callback, job, null, buf);
6460
};
6561

6662
job.run();
@@ -77,9 +73,7 @@ function scryptSync(password, salt, keylen, options = defaults) {
7773
if (err !== undefined)
7874
throw err;
7975

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

8579
function check(password, salt, keylen, options) {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.