md5 hash code example

Example 1: Create MD5 hash with Node.js

var string = 'some string';
var crypto = require('crypto');
var hash = crypto.createHash('md5').update(string).digest('hex');
console.log(hash);

Example 2: create md5 hash command line

~$ echo -n Welcome | md5sum
83218ac34c1834c26781fe4bde918ee4  -

Example 3: Create MD5 hash with Node.js

var crypto = require('crypto');
var hash = crypto.createHash('md5').update(string).digest('hex');
console.log(hash);

Example 4: js create md5 hash

var md5Hash = CryptoJS.MD5("Test");

Example 5: md5 encryption for existing records

UPDATE yourtable
SET hash = MD5(name)
WHERE hash IS NULL

Tags:

Sql Example