2

I want to use bcrypt to hash the app password. But I could not get the result about use that in android java. How can I use bcrypt hashing in android?

Hasan Cheraghi
  • 867
  • 2
  • 11
  • 26

1 Answers1

0

There is a Java implementation of the BCrypt algorithm here, I even use a modified version of it in my BCryptGenerator project.

Usage of the BCrypt class is as follows:

import com.whatever-domain.BCrypt


private String generateHashedPass(String pass) {
    // hash a plaintext password using the typical log rounds (10)
    return BCrypt.hashpw(pass, BCrypt.gensalt());
}

private boolean isValid(String clearTextPassword, String hashedPass) {
    // returns true if password matches hash
    return BCrypt.checkpw(clearTextPassword, hashedPass);
}
Dustin
  • 693
  • 8
  • 20