DEV Community

Discussion on: How to Securely Store a Password in Java

Collapse
 
billoneil profile image
Bill O'Neil

You can use BCrypt in Java as well Hashing passwords in Java with BCrypt.

public String hash(String password) {
    return BCrypt.hashpw(password, BCrypt.gensalt(logRounds));
}

public boolean verifyHash(String password, String hash) {
    return BCrypt.checkpw(password, hash);
}
Enter fullscreen mode Exit fullscreen mode