const crypto=require('crypto');
//var obj=crypto.createHash('md5');
var obj=crypto.createHash('sha256');
obj.update('1883263');
var str=obj.digest('hex');//hex是十六进制
console.log(str);
简写版
//用 SHA256算法对密码加密,管理员登录不用存储加密后的密码
userpass=crypto.createHash('SHA256').update(userpass).digest('hex');
点击此处进行在线加密。
