- 使用crypto
安装 cryptonpm 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