Ripemd-160 Hashing algorithm in node.js


Overview

RIPEMD (RACE Integrity Primitives Evaluation Message Digest) 160 is an improved version of ripemd and it usually generates a 40 digit hexadecimal number.

Code


													
//Name of the file : ripemd-160-hash.js
//Loading the crypto module in node.js
var crypto = require('crypto');
//creating hash object 
var hash = crypto.createHash('ripemd160');
//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 ripemd-160-hash.js
    hash : 6bbb8d56edec3a9e5add3d1439046982a91c7f47