Comeonin Bcrypt does not support the 2y prefix?
hariharasudhan94 opened this issue ยท 8 comments
I have a set passwords which have $2y$
prefix. When i trying to check password using Comeonin.Bcrypt.checkpw("hard to guess", stored_hash)
, I am getting error like Comeonin Bcrypt does not support the 2y prefix, how can i resolve this issue
The
Is there any other option or libraries, i can try right now?
I don't know anything in Elixir or Erlang that supports the
@riverrun as far as I understand,
PHP people had a bug in their implementation, and used special prefix
So, in a nutshell, hashes with
The
However, before I make any change, I obviously need to do a certain amount of research to decide how best to approach it. At the moment, I don't have the time to do that, but if there is a demand for
I hope that answers your questions.
I'm not sure if this should be supported to be fair.
Maybe we simply need better error message saying that this prefix is not supported, and you should replace it with compatible
I could look into improving the error message.
For what it's worth, this works for me:
Comeonin.Bcrypt.checkpw(password, fix_prefix(password_hash))
defp fix_prefix("$2y" <> rest), do: "$2b" <> rest
defp fix_prefix(password_hash), do: password_hash