Module org.elasticsearch.xcore
Enum Class Hasher
- All Implemented Interfaces:
Serializable,Comparable<Hasher>,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionReturns a list of lower case String identifiers for the Hashing algorithm and parameter combinations that can be used for password hashing in the cache.Returns a list of lower case String identifiers for the Hashing algorithm and parameter combinations that can be used for password hashing.Returns a list of lower case String identifiers for the Hashing algorithm and parameter combinations that can be used for secure token hashing.abstract char[]hash(SecureString data) static HasherReturns aHasherinstance of the appropriate algorithm and associated cost as indicated by thename.static HasherresolveFromHash(char[] hash) Returns aHasherinstance that can be used to verify thehashby inspecting the hash prefix and determining the algorithm used for its generation.static HasherReturns the enum constant of this class with the specified name.static Hasher[]values()Returns an array containing the constants of this enum class, in the order they are declared.abstract booleanverify(SecureString data, char[] hash) static booleanverifyHash(SecureString data, char[] hash) Verifies that the cryptographic hash ofdatais the same ashash.
-
Enum Constant Details
-
BCRYPT
-
BCRYPT4
-
BCRYPT5
-
BCRYPT6
-
BCRYPT7
-
BCRYPT8
-
BCRYPT9
-
BCRYPT10
-
BCRYPT11
-
BCRYPT12
-
BCRYPT13
-
BCRYPT14
-
PBKDF2
-
PBKDF2_1000
-
PBKDF2_10000
-
PBKDF2_50000
-
PBKDF2_100000
-
PBKDF2_500000
-
PBKDF2_1000000
-
PBKDF2_STRETCH
-
PBKDF2_STRETCH_1000
-
PBKDF2_STRETCH_10000
-
PBKDF2_STRETCH_50000
-
PBKDF2_STRETCH_100000
-
PBKDF2_STRETCH_500000
-
PBKDF2_STRETCH_1000000
-
SHA1
-
MD5
-
SSHA256
-
SHA256
-
NOOP
-
-
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
-
resolve
Returns aHasherinstance of the appropriate algorithm and associated cost as indicated by thename. Name identifiers for the default costs for BCRYPT and PBKDF2 return the default BCRYPT and PBKDF2 Hasher instead of the specific instances for the associated cost.- Parameters:
name- The name of the algorithm and cost combination identifier- Returns:
- the hasher associated with the identifier
-
resolveFromHash
Returns aHasherinstance that can be used to verify thehashby inspecting the hash prefix and determining the algorithm used for its generation. If no specific algorithm prefix, can be determinedHasher.NOOPis returned.- Parameters:
hash- the char array from which the hashing algorithm is to be deduced- Returns:
- the hasher that can be used for validation
-
verifyHash
Verifies that the cryptographic hash ofdatais the same ashash. The hashing algorithm and its parameters(cost factor-iterations, salt) are deduced from the hash itself. Thehashchar array is not cleared after verification.- Parameters:
data- the SecureString to be hashed and verifiedhash- the char array with the hash against which the string is verified- Returns:
- true if the hash corresponds to the data, false otherwise
-
getAvailableAlgoStoredPasswordHash
-
getAvailableAlgoStoredSecureTokenHash
-
getAvailableAlgoCacheHash
-
hash
-
verify
-