CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-scrypt-js

The scrypt password-based key derivation function with sync and cancellable async.

Overall
score

98%

Overview
Eval results
Files

task.mdevals/scenario-3/

Password Derivation Parameter Validator

A utility that validates and tests password-based key derivation with different cryptographic parameter configurations to ensure proper security levels.

Capabilities

Parameter Validation

Build a system that can derive cryptographic keys from passwords using configurable security parameters.

  • Given password "test123", salt [1,2,3,4,5,6,7,8], with parameters N=1024, r=8, p=1, dkLen=32, the system derives a 32-byte key @test
  • Given password "secure-password", salt [10,20,30,40,50,60,70,80], with parameters N=16384, r=8, p=1, dkLen=64, the system derives a 64-byte key @test
  • Given invalid parameter N=1023 (not power of 2), the system throws an error @test

Multi-Configuration Testing

The system should support testing multiple parameter configurations to compare security levels.

  • When comparing two different N values (1024 vs 16384) with same password and salt, the derived keys are different @test

Implementation

@generates

API

/**
 * Derives a cryptographic key from a password using specified parameters.
 *
 * @param {string} password - The password to derive a key from
 * @param {Array<number>} salt - The cryptographic salt (array of integers 0-255)
 * @param {number} N - CPU/memory cost parameter (must be power of 2)
 * @param {number} r - Block size parameter
 * @param {number} p - Parallelization parameter
 * @param {number} dkLen - Desired key length in bytes
 * @returns {Promise<Uint8Array>} The derived key
 */
async function deriveKey(password, salt, N, r, p, dkLen) {
  // IMPLEMENTATION HERE
}

module.exports = {
  deriveKey
};

Dependencies { .dependencies }

scrypt-js { .dependency }

Provides password-based key derivation functionality using scrypt algorithm with internal cryptographic primitives.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-scrypt-js

tile.json