Class DummyPasswordHasher

java.lang.Object
rs.baselib.crypto.DummyPasswordHasher
All Implemented Interfaces:
ExtendedPasswordHasher, PasswordHasher

public class DummyPasswordHasher extends Object implements ExtendedPasswordHasher
A dummy implementation that actually does not hash any password but uses the plain password.

This implementation shall be used for fallback testing when no other hash algorithm fits. You should never use this class to actually hash passwords.

Since:
1.2.9
Author:
ralph
  • Field Details

  • Constructor Details

    • DummyPasswordHasher

      public DummyPasswordHasher()
      Constructor.
  • Method Details

    • getPasswordHash

      public String getPasswordHash(String plainPassword)
      Returns a hash of the given plain password.
      Specified by:
      getPasswordHash in interface PasswordHasher
      Parameters:
      plainPassword - the password to be hashed
      Returns:
      the hash of the password
    • testPassword

      public boolean testPassword(String plainPassword, String passwordHash)
      Tests a plain Password whether it is the same as a previously hashed password.
      Specified by:
      testPassword in interface PasswordHasher
      Parameters:
      plainPassword - the plain password to be checked
      passwordHash - the hash of another password
      Returns:
      true when both passwords match each other
    • isHash

      public boolean isHash(String passwordHash)
      Returns whether the given hash string was produced using the implemented hashing algorithm.
      Specified by:
      isHash in interface ExtendedPasswordHasher
      Parameters:
      passwordHash - the hash to be checked
      Returns:
      true when this hash was produced by this password hasher (or using the same algorithm).