使用crypto
安装 crypto npm install crypto
测试
var crypto = require('crypto');
var content = '123456';
var result = crypto.createHash('md5').update(content).digest("hex")
console.log(result); //e10adc3949ba59abbe56e057f20f883e
使用md5-node
安装 md5-node
npm install md5-node
测试
var md5 = require('md5-node');
console.log(md5('123456'));//e10adc3949ba59abbe56e057f20f883e
md5加密验证查询:https://www.cmd5.com/hash.aspx