public enum Hash extends java.lang.Enum<Hash>
Enum.toString()
method should return the standard name used to retrieve theEnum Constant and Description |
---|
LOCKED |
MD5 |
SHA1 |
SHA256 |
SHA384 |
SHA512 |
Modifier and Type | Method and Description |
---|---|
boolean |
deprecatedByDefault() |
boolean |
enableByDefault() |
static Hash |
getDefault(AppContext c) |
java.security.MessageDigest |
getDigest() |
java.lang.String |
getHash(java.lang.String value)
get a hash value encoded as a hexadecimal string (for compatibility with
mysql built in hash functions).
|
static java.lang.String |
getHex(byte[] bytes) |
boolean |
isDeprecated(AppContext conn)
Is this an insecure hash that needs to be replaced
|
boolean |
isEnabled(AppContext conn)
Can this hash value be used to login
|
int |
size() |
static Hash |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Hash[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Hash MD5
public static final Hash SHA1
public static final Hash SHA256
public static final Hash SHA384
public static final Hash SHA512
public static final Hash LOCKED
public static Hash[] values()
for (Hash c : Hash.values()) System.out.println(c);
public static Hash valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic java.security.MessageDigest getDigest() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
public java.lang.String getHash(java.lang.String value) throws java.security.NoSuchAlgorithmException
value
- java.security.NoSuchAlgorithmException
public static java.lang.String getHex(byte[] bytes)
public int size()
public boolean enableByDefault()
public boolean deprecatedByDefault()
public boolean isEnabled(AppContext conn)
conn
- public boolean isDeprecated(AppContext conn)
conn
- public static Hash getDefault(AppContext c)