Skip to content

Instantly share code, notes, and snippets.

@goodjob1114
Last active August 29, 2015 14:22
Show Gist options
  • Save goodjob1114/ea782026151492017338 to your computer and use it in GitHub Desktop.
Save goodjob1114/ea782026151492017338 to your computer and use it in GitHub Desktop.
generate some secret hash based on Moment and Bcrypt.....just for fun
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