Package org.pgpainless.algorithm
Enum Class HashAlgorithm
- All Implemented Interfaces:
Serializable
,Comparable<HashAlgorithm>
,Constable
An enumeration of different hashing algorithms.
- See Also:
-
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 TypeMethodDescriptionstatic HashAlgorithm
fromId
(int id) Return theHashAlgorithm
value that corresponds to the provided algorithm id.static HashAlgorithm
Return theHashAlgorithm
value that corresponds to the provided name.int
Return the numeric algorithm id of the hash algorithm.Return the text name of the hash algorithm.static HashAlgorithm
requireFromId
(int id) Return theHashAlgorithm
value that corresponds to the provided algorithm id.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
-
MD5
Deprecated. -
SHA1
-
RIPEMD160
-
SHA256
-
SHA384
-
SHA512
-
SHA224
-
SHA3_256
-
SHA3_512
-
-
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
-
fromId
Return theHashAlgorithm
value that corresponds to the provided algorithm id. If an invalid algorithm id was provided, null is returned.- Parameters:
id
- numeric id- Returns:
- enum value
-
requireFromId
Return theHashAlgorithm
value that corresponds to the provided algorithm id. If an invalid algorithm id was provided, throw aNoSuchElementException
.- Parameters:
id
- algorithm id- Returns:
- enum value
- Throws:
NoSuchElementException
- in case of an unknown algorithm id
-
fromName
Return theHashAlgorithm
value that corresponds to the provided name. If an invalid algorithm name was provided, null is returned.- Parameters:
name
- text name- Returns:
- enum value
- See Also:
-
- RFC4880: ยง9.4 Hash Algorithms for a list of algorithms and names.
-
getAlgorithmId
public int getAlgorithmId()Return the numeric algorithm id of the hash algorithm.- Returns:
- numeric id
-
getAlgorithmName
Return the text name of the hash algorithm.- Returns:
- text name
-