Class PasswordHasher


  • public final class PasswordHasher
    extends java.lang.Object
    Utility methods for managing hashed passwords
    Author:
    Matthew Wakeling
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean checkPassword​(java.lang.String password, java.lang.String hash)
      Checks to see if a password matches an optionally hashed password entry.
      static java.lang.String hashPassword​(java.lang.String password)
      Converts a password into a hashed password, with a salt.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • hashPassword

        public static java.lang.String hashPassword​(java.lang.String password)
        Converts a password into a hashed password, with a salt.
        Parameters:
        password - the password to hash
        Returns:
        a 88-character String containing the salt and the hash
      • checkPassword

        public static boolean checkPassword​(java.lang.String password,
                                            java.lang.String hash)
        Checks to see if a password matches an optionally hashed password entry.
        Parameters:
        password - the given password
        hash - the hashed password entry
        Returns:
        true if the password matches