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 message authentication system that verifies the integrity and authenticity of messages using cryptographic techniques.
Create a module that provides functionality to:
@generates
/**
* Generates an authentication tag for a message.
*
* @param {string} algorithm - The hash algorithm to use (e.g., 'sha256', 'sha512')
* @param {string|Buffer} key - The secret key for authentication
* @param {string|Buffer} message - The message to authenticate
* @returns {string} The authentication tag in hexadecimal format
*/
function generateTag(algorithm, key, message) {
// IMPLEMENTATION HERE
}
/**
* Verifies a message's authentication tag.
*
* @param {string} algorithm - The hash algorithm used
* @param {string|Buffer} key - The secret key for authentication
* @param {string|Buffer} message - The message to verify
* @param {string} expectedTag - The expected authentication tag in hexadecimal
* @returns {boolean} True if the tag matches, false otherwise
*/
function verifyTag(algorithm, key, message, expectedTag) {
// IMPLEMENTATION HERE
}
/**
* Creates an incremental message authenticator for processing data in chunks.
*
* @param {string} algorithm - The hash algorithm to use
* @param {string|Buffer} key - The secret key for authentication
* @returns {Object} An object with update(chunk) and finalize() methods
*/
function createAuthenticator(algorithm, key) {
// IMPLEMENTATION HERE
// Returns object with:
// - update(chunk): adds a chunk to the message
// - finalize(): returns the final authentication tag in hexadecimal
}
module.exports = {
generateTag,
verifyTag,
createAuthenticator
};Provides cryptographic primitives for message authentication.