加密:

 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 })

 

相关文章:

  • 2021-12-07
  • 2021-12-09
  • 2022-12-23
  • 2021-09-28
  • 2021-12-23
  • 2022-01-10
  • 2021-12-29
  • 2021-12-24
猜你喜欢
  • 2022-01-26
  • 2021-11-17
  • 2021-12-19
  • 2021-11-17
  • 2022-12-23
  • 2021-04-14
  • 2021-06-18
相关资源
相似解决方案