Libraries

The following packages are included:

crypto

function generateHMAC(data, secret) {
    const hmac = crypto.createHmac('sha256', secret);
    hmac.update(data);
    return hmac.digest('hex');
}

function generateHash(data) {
    const hash = crypto.createHash('sha256');
    hash.update(data);
    return hash.digest('hex');
}

// HMAC Example
let data = 'myDataToHMAC';
let secret = 'mySecretKey';
let hashedData = generateHash(data);
let hmacResult = generateHMAC(data, secret);

console.log(hashedData);

list of all the available crypto commands

console.log(Object.keys(crypto));