node.js處理一些hash編碼(md5、sha1..etc)時,可以透過crypto module處理

var crypto = require('crypto');

var md5 = crypto.createHash('md5').update('TEST').digest("hex");
var sha1 = crypto.createHash('sha1').update('TEST').digest("hex");
var sha256 = crypto.createHash('sha256').update('TEST').digest("hex");

console.log(md5);
console.log(sha1);
console.log(sha256);
Categories: Node.js