You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using own salt, the salt is not truncated to 128 bits. This leads to different hashes between this implementation and say PHP (if you leave aside the $2y$ at the beginning).
It's best shown by example:
"$2y$10$123456789912345678901u.OtL1A1eGK5wmvBKUDYKvuVKI7h2XBu"
Here the last character is truncated to an u because of the 128 bit length of the salt.
See this Question on Security.Stackexchange.
I think there is no problem with the open bsd bcrypt module itself because both versions are valid:
When using own salt, the salt is not truncated to 128 bits. This leads to different hashes between this implementation and say PHP (if you leave aside the
$2y$
at the beginning).It's best shown by example:
Notice how in the resulting hash the salt ends with a 2:
"$2b$10$1234567899123456789012.OtL1A1eGK5wmvBKUDYKvuVKI7h2XBu"
Doing the same in PHP:
"$2y$10$123456789912345678901u.OtL1A1eGK5wmvBKUDYKvuVKI7h2XBu"
Here the last character is truncated to an
u
because of the 128 bit length of the salt.See this Question on Security.Stackexchange.
I think there is no problem with the open bsd bcrypt module itself because both versions are valid:
It's rather a problem with the return value from
hashpass/2
: https://github.com/riverrun/comeonin/blob/master/lib/comeonin/bcrypt.ex#L197Here the salt is just returned as given by the user, and I think this should be truncated to 128 bits.
The text was updated successfully, but these errors were encountered: