MCPcopy Create free account
hub / github.com/nodejs/node / testDeriveBits

Function testDeriveBits

test/pummel/test-webcrypto-derivebits-pbkdf2.js:403–422  ·  view source on GitHub ↗
(
  baseKeys,
  size,
  saltSize,
  hash,
  iterations)

Source from the content-addressed store, hash-verified

401}
402
403async function testDeriveBits(
404 baseKeys,
405 size,
406 saltSize,
407 hash,
408 iterations) {
409 const algorithm = {
410 name: 'PBKDF2',
411 salt: Buffer.from(kSalts[saltSize], 'hex'),
412 hash,
413 iterations,
414 };
415
416 const bits = await subtle.deriveBits(algorithm, baseKeys[size], 256);
417
418 assert(bits instanceof ArrayBuffer);
419 assert.strictEqual(
420 Buffer.from(bits).toString('hex'),
421 kDerivations[size][saltSize][hash][iterations]);
422}
423
424async function testDeriveBitsBadLengths(
425 baseKeys,

Calls 3

assertFunction · 0.50
fromMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected