From 8a468a5fde49d3b3a2cb969eefc4da3910a60aee Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Thu, 3 Oct 2024 15:27:10 +0000 Subject: [PATCH] Fix test generator for kdf --- test/generator.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/generator.js b/test/generator.js index dd307ff..cb2e63b 100644 --- a/test/generator.js +++ b/test/generator.js @@ -84,13 +84,13 @@ function executeKDFTests(limit = true) { should('PBKDF2(sha256) generator', async () => { const cases = genl({ c: integer(1, 1024), - dkLen: integer(0, 1024), + dkLen: integer(1, 1024), pwd: bytes(0, 1024), salt: bytes(0, 1024), }); for (let c of cases) { // console.log('T', c); - if (c.dkLen === 0) continue; + // if (c.dkLen === 0) continue; const exp = Uint8Array.from(crypto.pbkdf2Sync(c.pwd, c.salt, c.c, c.dkLen, 'sha256')); const opt = { c: c.c, dkLen: c.dkLen }; assert.deepStrictEqual(pbkdf2(sha256, c.pwd, c.salt, opt), exp, `pbkdf2(sha256, ${opt})`); @@ -105,11 +105,12 @@ function executeKDFTests(limit = true) { should('PBKDF2(sha512) generator', async () => { const cases = genl({ c: integer(1, 1024), - dkLen: integer(0, 1024), + dkLen: integer(1, 1024), pwd: bytes(0, 1024), salt: bytes(0, 1024), }); for (let c of cases) { + // if (c.dkLen === 0) continue; const exp = Uint8Array.from(crypto.pbkdf2Sync(c.pwd, c.salt, c.c, c.dkLen, 'sha512')); const opt = { c: c.c, dkLen: c.dkLen }; assert.deepStrictEqual(pbkdf2(sha512, c.pwd, c.salt, opt), exp, `pbkdf2(sha512, ${opt})`); @@ -124,7 +125,7 @@ function executeKDFTests(limit = true) { should('PBKDF2(sha3_256) generator', async () => { const cases = genl({ c: integer(1, 1024), - dkLen: integer(0, 1024), + dkLen: integer(1, 1024), pwd: bytes(0, 1024), salt: bytes(0, 1024), }); @@ -143,7 +144,7 @@ function executeKDFTests(limit = true) { should('PBKDF2(sha3_512) generator', async () => { const cases = genl({ c: integer(1, 1024), - dkLen: integer(0, 1024), + dkLen: integer(1, 1024), pwd: bytes(0, 1024), salt: bytes(0, 1024), }); @@ -186,7 +187,7 @@ function executeKDFTests(limit = true) { should('PBKDF2(blake2s) generator', async () => { const cases = genl({ c: integer(1, 1024), - dkLen: integer(0, 1024), + dkLen: integer(1, 1024), pwd: bytes(0, 1024), salt: bytes(0, 1024), }); @@ -205,7 +206,7 @@ function executeKDFTests(limit = true) { should('PBKDF2(blake2b) generator', async () => { const cases = genl({ c: integer(1, 1024), - dkLen: integer(0, 1024), + dkLen: integer(1, 1024), pwd: bytes(0, 1024), salt: bytes(0, 1024), });