- All Implemented Interfaces:
Serializable,Comparable<Hash.Algorithm>,Constable
- Enclosing class:
- Hash
Enumerates the hash algorithms supported by CSP hash-sources.
Each constant carries the lowercase algorithm name used in the CSP grammar and the expected Base64-encoded output length for validation purposes.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionintReturns the expected length of the Base64-encoded digest for this algorithm.toString()Returns the lowercase algorithm name as used in the CSP grammar (e.g.static Hash.AlgorithmReturns the enum constant of this class with the specified name.static Hash.Algorithm[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SHA256
SHA-256 algorithm (sha256), producing a 44-character Base64 digest. -
SHA384
SHA-384 algorithm (sha384), producing a 64-character Base64 digest. -
SHA512
SHA-512 algorithm (sha512), producing an 88-character Base64 digest.
-
-
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
-
getLength
public int getLength()Returns the expected length of the Base64-encoded digest for this algorithm.- Returns:
- the expected Base64 string length
-
toString
Returns the lowercase algorithm name as used in the CSP grammar (e.g."sha256").- Overrides:
toStringin classEnum<Hash.Algorithm>- Returns:
- the algorithm name string
-