Enum HashMethod
- java.lang.Object
-
- java.lang.Enum<HashMethod>
-
- ch.colabproject.colab.api.model.user.HashMethod
-
- All Implemented Interfaces:
Serializable
,Comparable<HashMethod>
public enum HashMethod extends Enum<HashMethod>
Hash method supported by the coLAB platform- Author:
- maxence
-
-
Enum Constant Summary
Enum Constants Enum Constant Description PBKDF2WithHmacSHA512_65536_64
PBKDF2 with HMAC SHA-512, 65536 iterations generates 64 bytes (ie.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract byte[]
hash(String value, byte[] salt)
compute digest from value.If given, the value is prefixed with the salt.byte[]
hash(String value, String hexSalt)
static HashMethod
valueOf(String name)
Returns the enum constant of this type with the specified name.static HashMethod[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
PBKDF2WithHmacSHA512_65536_64
public static final HashMethod PBKDF2WithHmacSHA512_65536_64
PBKDF2 with HMAC SHA-512, 65536 iterations generates 64 bytes (ie. 512 bits as SHA-512 does)
-
-
Method Detail
-
values
public static HashMethod[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (HashMethod c : HashMethod.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static HashMethod valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
hash
public abstract byte[] hash(String value, byte[] salt)
compute digest from value.If given, the value is prefixed with the salt.- Parameters:
value
- the value to hashsalt
- optional salt- Returns:
- digested salted value
-
hash
public byte[] hash(String value, String hexSalt)
- Parameters:
value
- value to hashhexSalt
- hexEncoded salt- Returns:
- digested salted value
- See Also:
hash(java.lang.String, byte[])
-
-