Enum Class HashAlgorithm

java.lang.Object
java.lang.Enum<HashAlgorithm>
org.apache.nifi.security.util.crypto.HashAlgorithm
All Implemented Interfaces:
Serializable, Comparable<HashAlgorithm>, Constable

public enum HashAlgorithm extends Enum<HashAlgorithm>
Enumeration capturing information about the cryptographic hash algorithms
  • Enum Constant Details

  • Field Details

    • name

      private final String name
    • digestBytesLength

      private final int digestBytesLength
    • description

      private final String description
    • BROKEN_ALGORITHMS

      private static final List<String> BROKEN_ALGORITHMS
  • Constructor Details

    • HashAlgorithm

      private HashAlgorithm(String name, int digestBytesLength, String description)
  • Method Details

    • values

      public static HashAlgorithm[] 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 HashAlgorithm 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
    • getName

      public String getName()
    • getDigestBytesLength

      public int getDigestBytesLength()
    • getDescription

      public String getDescription()
    • isStrongAlgorithm

      public boolean isStrongAlgorithm()
      Returns true if this algorithm is considered cryptographically secure. These determinations were made as of 2018-08-30. Current strong algorithms: * SHA-224 (SHA2) * SHA-256 (SHA2) * SHA-384 (SHA2) * SHA-512 (SHA2) * SHA-512/224 (SHA2) * SHA-512/256 (SHA2) * SHA3-224 * SHA3-256 * SHA3-384 * SHA3-512 * Blake2b-160 * Blake2b-256 * Blake2b-384 * Blake2b-512 Current broken algorithms: * MD2 * MD5 * SHA-1
      Returns:
      true if the algorithm is considered strong
    • isBlake2

      public boolean isBlake2()
      Returns true if this hash algorithm is Blake2, as it requires different initialization through BouncyCastle.
      Returns:
      true if this algorithm is in the Blake2 family
    • toString

      public String toString()
      Overrides:
      toString in class Enum<HashAlgorithm>
    • buildAllowableValueDescription

      public String buildAllowableValueDescription()
      Returns a more complete description of the algorithm for AllowableValue construction. Ex: description -- Cryptographically broken due to collisions buildAllowableValueDescription -- SHA-1 (20 byte output) [WARNING -- Cryptographically broken] Cryptographically broken due to collisions
      Returns:
      the description for dropdown help
    • fromName

      public static HashAlgorithm fromName(String algorithmName)