This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('bluebird'); | |
var crypto = Promise.promisifyAll(require("crypto")); | |
// http://security.stackexchange.com/questions/110084/parameters-for-pbkdf2-for-password-hashing | |
var config = { | |
hashBytes : 64, // size of the generated hash (to be chosen accordint the the chosen algo) | |
saltBytes : 16, // sise of the salt : larger salt means hashed passwords are more resistant to rainbow table | |
iterations : 500000, // tune so that hashing the password takes about 1 second | |
algo :'sha512', | |
encoding : 'base64' // hex is readable but base64 is shorter |