tessl install tessl/npm-crypto-browserify@3.12.0Browser-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%
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.
@generates
/**
* 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
};Provides cryptographic hashing functionality for computing file integrity checksums.