Ejemplo n.º 1
0
var saltAndHash = function(pass, callback) {

    //console.log("Launching scrypt");

    scrypt.passwordHash(pass,0.1,function(err, pwdhash) {
        if(!err) {
            callback(pwdhash);
        }
        else {
            console.log("Scrypt failed...")
        }
    });
}
Ejemplo n.º 2
0
CouchbaseDBC.prototype.createUser = function(userID, passwd, cb)
{
	var db = this.db;
	//scrypt.hash.config.keyEncoding = "utf8";
	//scrypt.hash(passwd, {N: 1, r:1, p:1}, function(err, result)
	scrypt.passwordHash(passwd, 0.1, 0, 0.5, function(err, result)
	{
		if(err)
			cb(err);
		else // fixme: turn to add
			db.set(conf.user.prefix + userID, {'user': userID, 'password': result}, function(err, res)
			{
				if(err)
					cb(err);
				else
					cb(undefined, userID);
			});
	});
}
Ejemplo n.º 3
0
        }).then(function(pbkdf2Hash) {
            pbkdf2Hash = pbkdf2Hash.toString('base64');

            return scrypt.passwordHash(pbkdf2Hash, config.crypt.scryptParameters);
        }).then(function(finalHash) {