I am storing passwords on a SQL database, using PHP and planning to use bcrypt.
I was doing some research to find what types and size I should use to store the hash and salt in my database.
Based on the great answer to this question, it seems that bcrypt sometimes outputs different sized hashes, maybe as large as CHAR(76)
or BINARY(60)
. But I don't understand when and why.
That question provides a link which says that using the $2$
scheme produces 59 bytes, and $2a$
produces 60 bytes. However today's documentation for php's crypt recommends using $2y$
over $2a$
, for some reason due to high bit attacks, or something. Anyway, I would like to use $2y$
as it is recommended, however there is no indication of the size of the has it will output.
What should the size of my fields in the database be?
Also, is there any practical difference between CHAR
and BINARY
in this sort of application?