Slide 15
Slide 15 text
!
var crypto = require('crypto');!
!
app.post("/register", function(req, res){!
//capture user login information!
var username = req.body.username;!
var password = req.body.password;!
!
//generate salt, then hash!
crypto.randomBytes(32, function(ex, salt){!
crypto.pbkdf2(password, salt, 4096, 512, 'sha256', function(err, key){!
if (err) throw err;!
//store username, hashed password, and salt in your database!
});!
});!
});!
!
Hashing with PBKDF2!