Whirlpool Hashing algorithm in node.js


Overview

This hashing algorithm takes input of any length less than 2256 bits and outputs a 512-bit hash.

Code


													
//whirlpool-hash.js
//Loading the crypto module in node.js
var crypto = require('crypto');
//creating hash object 
var hash = crypto.createHash('whirlpool');
//passing the data to be hashed
data = hash.update('nodejsera', 'utf-8');
//Creating the hash in the required format
gen_hash= data.digest('hex');
//Printing the output on the console
console.log("hash : " + gen_hash);
						
					

													
												

Run

  • Now run the snippet using the following command :
    													
    >node whirlpool-hash.js
    hash : 1d241d8e774492fcbab619d12f4e8ba82ca4327a97c0b955f97e9a8e99621be71a3c9db8c5c55685dfd478ba1c091711534877efe
    249eee719d7d6132657a1dc