Last active
August 29, 2015 14:22
-
-
Save goodjob1114/ea782026151492017338 to your computer and use it in GitHub Desktop.
generate some secret hash based on Moment and Bcrypt.....just for fun
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 co = require('co') | |
var bcrypt = require('bcrypt') | |
var moment = require('moment') | |
var Promise = require('bluebird') | |
var bSalt = Promise.promisify(bcrypt.genSalt) | |
var bHash = Promise.promisify(bcrypt.hash) | |
var passphrase = moment().format('YYYY[RandomString]MMDDHH') | |
console.log('passphrase =',passphrase) | |
co(function *() { | |
var salt = yield bSalt(10) | |
var hash = yield bHash(passphrase, salt) | |
console.log(hash) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment