Enum Class HashAlgorithm
- All Implemented Interfaces:
Serializable
,Comparable<HashAlgorithm>
,Constable
Enumeration capturing information about the cryptographic hash algorithms
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
HashAlgorithm
(String name, int digestBytesLength, String description) -
Method Summary
Modifier and TypeMethodDescriptionReturns a more complete description of the algorithm forAllowableValue
construction.static HashAlgorithm
int
getName()
boolean
isBlake2()
Returnstrue
if this hash algorithm is Blake2, as it requires different initialization through BouncyCastle.boolean
Returnstrue
if this algorithm is considered cryptographically secure.toString()
static HashAlgorithm
Returns the enum constant of this class with the specified name.static HashAlgorithm[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MD2
-
MD5
-
SHA1
-
SHA224
-
SHA256
-
SHA384
-
SHA512
-
SHA512_224
-
SHA512_256
-
SHA3_224
-
SHA3_256
-
SHA3_384
-
SHA3_512
-
BLAKE2_160
-
BLAKE2_256
-
BLAKE2_384
-
BLAKE2_512
-
-
Field Details
-
name
-
digestBytesLength
private final int digestBytesLength -
description
-
BROKEN_ALGORITHMS
-
-
Constructor Details
-
HashAlgorithm
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
getName
-
getDigestBytesLength
public int getDigestBytesLength() -
getDescription
-
isStrongAlgorithm
public boolean isStrongAlgorithm()Returnstrue
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()Returnstrue
if this hash algorithm is Blake2, as it requires different initialization through BouncyCastle.- Returns:
- true if this algorithm is in the Blake2 family
-
toString
- Overrides:
toString
in classEnum<HashAlgorithm>
-
buildAllowableValueDescription
Returns a more complete description of the algorithm forAllowableValue
construction. Ex:description
-- Cryptographically broken due to collisionsbuildAllowableValueDescription
-- SHA-1 (20 byte output) [WARNING -- Cryptographically broken] Cryptographically broken due to collisions- Returns:
- the description for dropdown help
-
fromName
-