Class PasswordHelper

  • public class PasswordHelper
    extends Object
    Helper to check passwords and generated hashed salted ones.
    • Method Detail

      • isHashed

        public static boolean isHashed​(String password)
        Checks if a password is already hashed.
        true if the password is hashed
      • hashPassword

        public static String hashPassword​(String password,
                                          String algorithm)
        Returns the hashed string for a password according to a given hashing algorithm.
        algorithm - the algorithm, SSHA or SMD5, or null to not hash
        password - the password
        the hashed password
      • verifyPassword

        public static boolean verifyPassword​(String password,
                                             String hashedPassword)
        Verify a password against a hashed password.

        If the hashed password is null then the verification always fails.

        password - the password to verify
        hashedPassword - the hashed password
        true if the password matches