I\'m trying to implement authentication using BCrypt, in my Play 2.1. Java application, but I\'m getting Invalid salt version exception
when I\'m trying to authenti
in my case, I have used {bcrypt}
as a prefix during the insertion into db.
instance
{bcrypt}$2a$12$Yb3YagKV8B3AXoY2p/Ldk.L2maVKfNlr2dedk4ZUs/YUlalS8EzYu
when I retrieve the password the whole value including prefix
will be returned. So I have excluded the prefix from the hashing
value.
String prefix= "{bcrypt}";
String hash_pw= user.getPassword().substring((prefix.length());
BCrypt.checkpw(loginRequest.getPassword(),hash_pw);