Class BCrypt

java.lang.Object
com.peterphi.usermanager.db.BCrypt

public class BCrypt extends Object
A wrapper for BCrypt
  • Field Details

  • Constructor Details

    • BCrypt

      public BCrypt()
  • Method Details

    • hash

      public static String hash(char[] password, int cost)
      Parameters:
      password - the plaintext password
      cost - the computation cost (complexity increases at 2**cost)
      Returns:
    • verify

      public static boolean verify(String hash, char[] password)
      Check that a plaintext password matches a previously hashed one
      Parameters:
      password - the plaintext password to verify
      hash - the previously-hashed password (a 60-character BCrypt hash string)
      Returns:
      true if the passwords match, false otherwise