Generating HMAC using whirlpool hashing algorithm


This hashing algorithm takes input of any length less than 2256 bits and outputs a 512-bit hash. HMAC involves hashing with the help of a secret key as shown in the snippet below :


//Name of the file : whirlpool-hmac.js
//Loading the crypto module in node.js
var crypto = require('crypto');
//creating hmac object 
var hmac = crypto.createHmac('whirlpool', 'yoursecretkeyhere');
//passing the data to be hashed
data = hmac.update('nodejsera');
//Creating the hmac in the required format
gen_hmac= data.digest('hex');
//Printing the output on the console
console.log("hmac : " + gen_hmac);


  • Now run the snippet using the following command :
    >node whirlpool-hmac.js
    hmac : c7fe72214a9830c397e7f01296f257a66d1aef002cea8ca7cf27fbd66e399d7ec52474bd2a0524f28955753ae93e9c2f55925584f