Skip to content

Instantly share code, notes, and snippets.

@daneroo
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save daneroo/9357063 to your computer and use it in GitHub Desktop.

Select an option

Save daneroo/9357063 to your computer and use it in GitHub Desktop.
-- comma-10
password 12345
encrypted $2a$10$Su9ZTjPsGLIem1CfMGApteTVA9sXEgYllWnm.aDr5Y1.KGynwUAg2
rounds 10
-- genSalt-no-params
password 12345
encrypted $2a$10$BOdSeAtFbxqj9Np/Rzv2VuPaJg2B7c3CxxU2pI9XsVMgfcpG2Rb7i
rounds 10
-- genSalt(10)
password 12345
encrypted $2a$10$42WiV0KCbew.I2s2PXFqOuRZzELACiS0jEfRcx3Ml3.OsY4gdH6H.
rounds 10
-- genSalt(15)
password 12345
encrypted $2a$15$A4hP.g7JZ9txknz3MvvCZeJiGmT0QIJnV28ZQD1BLV13E3u89UvkW
rounds 15
-- genSalt(2)
password 12345
encrypted $2a$04$L7UP9sTrA/gs4qb6FfBLa.Daz8y12EyuAlFLqZbCJM.THNgoL7ldm
rounds 4
'use strict';
var bcrypt = require('bcrypt');
var password = "12345";
function show(pfx, password, encrypted) {
console.log('--',pfx);
console.log(' password', password);
console.log(' encrypted', encrypted);
console.log(' rounds', bcrypt.getRounds(encrypted));
}
show('comma-10', password, bcrypt.hashSync(password,10));
show('genSalt-no-params', password, bcrypt.hashSync(password, bcrypt.genSaltSync()));
show('genSalt(10)', password, bcrypt.hashSync(password, bcrypt.genSaltSync(10)));
show('genSalt(15)', password, bcrypt.hashSync(password, bcrypt.genSaltSync(15)));
show('genSalt(2)', password, bcrypt.hashSync(password, bcrypt.genSaltSync(2)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment