anowell / bcrypt / 0.1.2

Generate or verify passwords hashes using bcrypt.

Generate password hashes

Specify an array of passwords under the passwords key. You may optionally specify a number of rounds:

"passwords": ["foo", "bar", "baz"],
"rounds": 8

And the output will be an array of hashes that map to the input passwords:


For what it's worth: '$' is a separator character in these hashes. $2b refers to the bcrypt algorithm, and the $08 indicates 8 rounds were used. The remainder is the encrypted combination of password and a random salt.

Verify password hashes

To verify a list of password and bcrypt hash pairings, specify the pairings (password-first) as input using the "verify" key:
"verify": [
["foo", "$2b$08$noVcQRFm4A0GvtVxgv15semg7KKQgPOJAQh9hU6px4SsTVC6IOa/G"],
["bar", "$2b$08$noVcQRFm4A0GvtVxgv15semg7KKQgPOJAQh9hU6px4SsTVC6IOa/G"],
["baz", "$2b$08$DIYSyv.UTDn3r1pZ07JyOuCihyfFrXR1EA7HgWF1eec1AfsJImmwu"]

The output will be an array of booleans that map to the input pairings.
[true, false, true]