bcrypt.js icon indicating copy to clipboard operation
bcrypt.js copied to clipboard

Any security downsides to auto-generating salt?

Open pietrorea opened this issue 3 years ago • 0 comments

Hello :wave: — are there any known security implications for generating the salt separately from the hashing call? Specifically...

Doing them separate:

var salt = bcrypt.genSaltSync(10);
var hash = bcrypt.hashSync("aPassword", salt);

All in one go:

const passwordHash = bcrypt.hashSync('aPassword', 10);

I guess you could provide your own salt? Is that a common practice? Otherwise, why did you include two separate ways to achieve the same thing in the API?

pietrorea avatar Feb 04 '22 16:02 pietrorea