常见的密码加密的两种方式

加密:

 md5加密    有加密  也有解密

 sha256加密  只有加密  没有解密

 1 /* 加密 1*/
 2 const crypto = require('crypto');
 3 //创建加密模式 sha256  2
 4 const hash = crypto.createHash('sha256');
 5 //加密的数据  3
 6 hash.update(password);
 7 //加密的结果  4
 8 //console.log(hash.digest('hex'));
 9 userModel.userSave({username,password:hash.digest('hex')},(result)=>{
10     if(result){
11         res.json({
12             status:true,
13             info:"注册成功"
14         })
15     }
16 })
原文地址:https://www.cnblogs.com/-Bloom/p/10282025.html