Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6fa6d69

Browse filesBrowse files
jellyaduh95
authored andcommitted
test: make test-crypto-hash compatible with OpenSSL > 3.4.0
OpenSSL 3.4 has a breaking change where the outputLength is now mandatory for shake* hash algorithms. openssl/openssl@b911fef PR-URL: #56160 Refs: #56159 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent 48c813f commit 6fa6d69
Copy full SHA for 6fa6d69

File tree

Expand file treeCollapse file tree

1 file changed

+16
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-13
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-crypto-hash.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-crypto-hash.js
+16-13Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const assert = require('assert');
77
const crypto = require('crypto');
88
const fs = require('fs');
99

10+
const { hasOpenSSL } = common;
1011
const fixtures = require('../common/fixtures');
1112

1213
let cryptoType;
@@ -182,19 +183,21 @@ assert.throws(
182183

183184
// Test XOF hash functions and the outputLength option.
184185
{
185-
// Default outputLengths.
186-
assert.strictEqual(crypto.createHash('shake128').digest('hex'),
187-
'7f9c2ba4e88f827d616045507605853e');
188-
assert.strictEqual(crypto.createHash('shake128', null).digest('hex'),
189-
'7f9c2ba4e88f827d616045507605853e');
190-
assert.strictEqual(crypto.createHash('shake256').digest('hex'),
191-
'46b9dd2b0ba88d13233b3feb743eeb24' +
192-
'3fcd52ea62b81b82b50c27646ed5762f');
193-
assert.strictEqual(crypto.createHash('shake256', { outputLength: 0 })
194-
.copy() // Default outputLength.
195-
.digest('hex'),
196-
'46b9dd2b0ba88d13233b3feb743eeb24' +
197-
'3fcd52ea62b81b82b50c27646ed5762f');
186+
// Default outputLengths. Since OpenSSL 3.4 an outputLength is mandatory
187+
if (!hasOpenSSL(3, 4)) {
188+
assert.strictEqual(crypto.createHash('shake128').digest('hex'),
189+
'7f9c2ba4e88f827d616045507605853e');
190+
assert.strictEqual(crypto.createHash('shake128', null).digest('hex'),
191+
'7f9c2ba4e88f827d616045507605853e');
192+
assert.strictEqual(crypto.createHash('shake256').digest('hex'),
193+
'46b9dd2b0ba88d13233b3feb743eeb24' +
194+
'3fcd52ea62b81b82b50c27646ed5762f');
195+
assert.strictEqual(crypto.createHash('shake256', { outputLength: 0 })
196+
.copy() // Default outputLength.
197+
.digest('hex'),
198+
'46b9dd2b0ba88d13233b3feb743eeb24' +
199+
'3fcd52ea62b81b82b50c27646ed5762f');
200+
}
198201

199202
// Short outputLengths.
200203
assert.strictEqual(crypto.createHash('shake128', { outputLength: 0 })

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.