diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js index 982b0ac6d5b640..908179b46e3071 100644 --- a/test/parallel/test-crypto-scrypt.js +++ b/test/parallel/test-crypto-scrypt.js @@ -187,6 +187,24 @@ for (const options of toobig) { })); } +{ + const defaultEncoding = crypto.DEFAULT_ENCODING; + const defaults = { N: 16384, p: 1, r: 8 }; + const expected = crypto.scryptSync('pass', 'salt', 1, defaults); + + const testEncoding = 'latin1'; + crypto.DEFAULT_ENCODING = testEncoding; + const actual = crypto.scryptSync('pass', 'salt', 1); + assert.deepStrictEqual(actual, expected.toString(testEncoding)); + + crypto.scrypt('pass', 'salt', 1, common.mustCall((err, actual) => { + assert.ifError(err); + assert.deepStrictEqual(actual, expected.toString(testEncoding)); + })); + + crypto.DEFAULT_ENCODING = defaultEncoding; +} + for (const { args, expected } of badargs) { common.expectsError(() => crypto.scrypt(...args), expected); common.expectsError(() => crypto.scryptSync(...args), expected);