请问,用Express来做用户注册页面,用户密码的加密是要怎么做的?
直接MD5可以吗?
回复 (4)
H
请查看http://docs.cnodejs.net/cman/crypto.html nodejs有api可以调用加密的!
H
给你看个md5加密代码给你看看:
var crypto = require('crypto');
var hash = crypto.createHash("md5");
hash.update(new Buffer("huangdanhua", "binary"));
var encode = hash.digest('hex');
console.log(encode);
G
现在比较安全的模式是bcrypt+https
var bcrypt = require('bcrypt'); ... var salt = bcrypt.genSaltSync(10); pass = bcrypt.hashSync(pass, salt);
A
现在md5加密也都不怎么安全了,百度都能搜索到md5加密解密库。不知道nodejs是否支持rsa加密算法~
参与回复
登录后即可参与回复。登录