BCrypt.checkpw returning false

284 Views Asked by At

I have a user row in my user table that has a password (don't worry, it's a dummy password) that was encrypted using BCrypt.hashpw:

System.out.println(BCrypt.hashpw("1234", BCrypt.gensalt()));
// $2a$10$IIAj7Ft6yGWk6I7bmYUzy.1UrtHVbX.N5z1CdfhG3GGpIib06oDv.

I then want to verify that password using BCrypt.checkpw:

System.out.println(BCrypt.checkpw("1234", "$2a$10$IIAj7Ft6yGWk6I7bmYUzy.1UrtHVbX.N5z1CdfhG3GGpIib06oDv."));
// false

Why does it return false?

0

There are 0 best solutions below