How To Calculate In Java A Bcrypt Password Compatible With Laravel
I have a system built in laravel and I have created an API. The problem is in Authentication. I have an Android app and want to authenticate with the laravel system by the followin
Solution 1:
I need made a workaround here to work, because when I generate with PHP, hash starts with $2y$ and java starts with $2a$.
To solve this, I create a regex in java before password match to replace $2y$ to $2a$ and works for me.
In PHP I used the native function:
$hash = password_hash($pass, PASSWORD_DEFAULT);
and in java I used jbcrypt lib.
Solution 2:
It worked for me using Bcrypt.checkpw("plain_password", "encrypted_password")
. I replaced the bcrypt encrypted hash with $2a$ at the beginning.
Post a Comment for "How To Calculate In Java A Bcrypt Password Compatible With Laravel"