@@ -7,6 +7,7 @@ const assert = require('assert');
7
7
const crypto = require ( 'crypto' ) ;
8
8
const fs = require ( 'fs' ) ;
9
9
10
+ const { hasOpenSSL } = common ;
10
11
const fixtures = require ( '../common/fixtures' ) ;
11
12
12
13
let cryptoType ;
@@ -182,19 +183,21 @@ assert.throws(
182
183
183
184
// Test XOF hash functions and the outputLength option.
184
185
{
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
+ }
198
201
199
202
// Short outputLengths.
200
203
assert . strictEqual ( crypto . createHash ( 'shake128' , { outputLength : 0 } )
0 commit comments