kelektiv / node.bcrypt.js

bcrypt for NodeJs
MIT License
7.38k stars 510 forks source link

Clarify how long the password hash and salt are so I can make my database schema and if and how they can be chanced. #997

Open CookingWithCale opened 10 months ago

CookingWithCale commented 10 months ago

#

Problem

I need to know how long the resulting password hash and salt are to store them in my SQL database and if I can change the bit depth. The documentation is not clear what bit depth the hash is. The only thing mentioned in the ReadMe.md file is about a 192-bit (31 characters base 10 encoded) and the salt is 128-bits (22 characters base 10 encoded) but it's not clear if this is the official bit depths.

Given that SQL table data is cached with the OS in-RAM filesystem cache, it's best to word align your SQL tables. I would like to use a 256-bit hash and word-align the salt so that the hashed password and salt are both word-aligned, which will make my database run faster, but I can't find information about how to change the number of random bytes in the salt

Solution

It would be a LOT easier to understand how to use this software if you would add a simple SQL table schema to store the hash and salt for a basic login system, including an example password hash and salt and password verification function.

Also, it would be nice to not have to search so much to find the simple answer to Can I change the bit depth of the hash and the salt? If you can't change the bit depth then explain why I don't need a 256-bit hash and a 192-bit hash is good enough. I've wasted a lot of hours trying to figure this out and it should be in the ReadMe.md.