Class PasswordHasher

java.lang.Object
com.example.project.services.PasswordHasher

public class PasswordHasher extends Object
Hashes passwords.
  • Constructor Details

    • PasswordHasher

      public PasswordHasher()
  • Method Details

    • hashPassword

      public static String hashPassword(String rawPassword)
      Hashes a raw password using BCrypt.
      Parameters:
      rawPassword - the plain text password
      Returns:
      the hashed password string
    • checkPassword

      public static boolean checkPassword(String candidate, String hashed)
      Verifies a candidate password against a hashed password.
      Parameters:
      candidate - the plain text password entered by the user
      hashed - the hashed password stored in the database
      Returns:
      true if the password matches, false otherwise