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-9/

Password Key Derivation with Progress Tracking

Build a password hashing utility that derives cryptographic keys from user passwords while providing real-time progress feedback. The utility should handle long-running key derivation operations without blocking the event loop, allowing other application logic to continue processing.

Capabilities

Progress Tracking During Key Derivation

  • Given a password "mySecurePassword123", salt buffer of 16 bytes, N=16384, r=8, p=1, and dkLen=32, the deriveKeyWithProgress function tracks progress and logs at least 3 progress updates between 0% and 100% before returning the derived key @test

Non-Blocking Key Derivation

  • Given a password "testPassword", salt buffer of 8 bytes, N=1024, r=8, p=1, and dkLen=32, the deriveKeyWithProgress function completes key derivation while allowing a counter variable to increment at least 5 times during the operation, demonstrating non-blocking behavior @test

Multiple Concurrent Derivations

  • Given two password derivation operations started simultaneously with different passwords ("password1" and "password2"), same salt buffer of 16 bytes, N=4096, r=8, p=1, and dkLen=32, both operations complete successfully and return different derived keys @test

Implementation

@generates

API

/**
 * Derives a cryptographic key from a password with progress tracking.
 *
 * @param {string} password - The password to derive the key from
 * @param {Buffer|Uint8Array} salt - Cryptographic salt (recommended: 16+ bytes)
 * @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 length of derived key in bytes
 * @param {Function} progressCallback - Callback function that receives progress (0 to 1)
 * @returns {Promise<Uint8Array>} The derived key
 */
async function deriveKeyWithProgress(password, salt, N, r, p, dkLen, progressCallback) {
  // IMPLEMENTATION HERE
}

module.exports = {
  deriveKeyWithProgress
};

Dependencies { .dependencies }

scrypt-js { .dependency }

Provides password-based key derivation with non-blocking asynchronous execution.

Install with Tessl CLI

npx tessl i tessl/npm-scrypt-js

tile.json