Interface HashAlgorithm


  • public interface HashAlgorithm
    • Method Detail

      • getID

        String getID()
        Returns an id for that algorithm. For any set of algorithms returning the same id any algorithm of that set should be able to check any hashes created by any other algorithm of that set.
      • getDescription

        String getDescription()
        Return a description of the algorithm. May contain additional info, that does not prevent hashing compatibility required by getID().
      • hash

        String hash​(String plainText)
        Returns a hash for the given plain text. The result is not required to be deterministic - this means, multiple calls for the same plain text do not have to return the same hash. This is especially true for salted hashes.
        Parameters:
        plainText - the text to be hashed. Is never null.
        Returns:
        the hash of plainText. Must never return null.
      • check

        boolean check​(String plainText,
                      String hash)
        Returns whether the given plain text matches the given hash.
        Parameters:
        plainText - the text to be hashed. Is never null.
        hash - the hash of plainText. Is never null.