I set up a site with Node.js+passport for user authentication.
Now I need to migrate to Golang, and need to do authentication with the user passwords saved in db.
The Node.js encryption code is:
var bcrypt = require('bcrypt');
bcrypt.genSalt(10, function(err, salt) {
if(err) return next(err);
bcrypt.hash(user.password, salt, function(err, hash) {
if(err) return next(err);
user.password = hash;
next();
});
});
How to make the same hashed string as Node.js bcrypt with Golang?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…