CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-crypto-browserify

tessl install tessl/npm-crypto-browserify@3.12.0

Browser-compatible implementation of Node.js crypto module providing cryptographic operations in web environments.

Agent Success

Agent success rate when using this tile

100%

Improvement

Agent success rate improvement when using this tile compared to baseline

1x

Baseline

Agent success rate without this tile

100%

task.mdevals/scenario-5/

File Integrity Checker

Build a utility that computes cryptographic hashes for files to verify their integrity. The utility should support multiple hash algorithms and handle various input formats.

Capabilities

Hash Computation

  • Computes SHA-256 hash of a UTF-8 string and returns it as a hexadecimal string @test
  • Computes MD5 hash of binary data (Buffer) and returns it as a hexadecimal string @test
  • Computes SHA-512 hash and returns the result as a base64-encoded string @test

Algorithm Discovery

  • Lists all available hash algorithms and verifies SHA-256 and MD5 are supported @test

Incremental Hashing

  • Processes data in multiple chunks using incremental updates and produces the same hash as single-pass hashing @test

Hash Comparison

  • Compares two files by their SHA-256 hashes and correctly identifies when they match @test
  • Compares two files by their SHA-256 hashes and correctly identifies when they differ @test

Implementation

@generates

API

/**
 * Computes a cryptographic hash of the input data.
 *
 * @param {string|Buffer} data - The data to hash
 * @param {string} algorithm - The hash algorithm to use (e.g., 'sha256', 'md5', 'sha512')
 * @param {string} outputEncoding - The encoding for the output hash (e.g., 'hex', 'base64')
 * @returns {string} The computed hash in the specified encoding
 */
function computeHash(data, algorithm, outputEncoding) {
  // Implementation here
}

/**
 * Computes a hash using incremental updates.
 *
 * @param {Array<string|Buffer>} dataChunks - An array of data chunks to hash
 * @param {string} algorithm - The hash algorithm to use
 * @param {string} outputEncoding - The encoding for the output hash
 * @returns {string} The computed hash in the specified encoding
 */
function computeIncrementalHash(dataChunks, algorithm, outputEncoding) {
  // Implementation here
}

/**
 * Lists all available hash algorithms.
 *
 * @returns {Array<string>} Array of supported hash algorithm names
 */
function listHashAlgorithms() {
  // Implementation here
}

/**
 * Compares hashes of two data inputs.
 *
 * @param {string|Buffer} data1 - First data input
 * @param {string|Buffer} data2 - Second data input
 * @param {string} algorithm - The hash algorithm to use for comparison
 * @returns {boolean} True if hashes match, false otherwise
 */
function compareHashes(data1, data2, algorithm) {
  // Implementation here
}

module.exports = {
  computeHash,
  computeIncrementalHash,
  listHashAlgorithms,
  compareHashes
};

Dependencies { .dependencies }

crypto-browserify { .dependency }

Provides cryptographic hashing functionality for computing file integrity checksums.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/crypto-browserify@3.12.x
tile.json