Enum Class Hasher

java.lang.Object
java.lang.Enum<Hasher>
com.github.natche.gravatarjavaclient.utils.Hasher
All Implemented Interfaces:
Serializable, Comparable<Hasher>, Constable

public enum Hasher extends Enum<Hasher>
A singleton for hashing inputs.
  • Enum Constant Details

    • SHA256

      public static final Hasher SHA256
      The SHA256 hasher.
  • Method Details

    • values

      public static Hasher[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Hasher valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • hash

      public String hash(String input)
      Hashes the provided input using the encapsulated algorithm. Note: prior to hashing, the input is trimmed and converted to lower case.
      Parameters:
      input - the input to hash
      Returns:
      the hashed input
      Throws:
      NullPointerException - if the provided input is null
      GravatarJavaClientException - if a MessageDigest instance cannot be obtained