public enum DigestAlgorithm extends java.lang.Enum<DigestAlgorithm>
| Enum Constant and Description |
|---|
CRC32
CRC-32 (a hexidecimal-encoded CRC-32 produced using the java.util.zip CRC32 class)
|
LENGTH
Length (an algorithm which takes the length of the data, in decimal, as its digest)
|
MD2
|
MD5
|
SHA1
|
SHA256
SHA-256
|
SHA512
SHA-512
|
| Modifier and Type | Field and Description |
|---|---|
static java.util.Comparator<DigestAlgorithm> |
COMPARE
The comparator to use when comparing algorithms ignoring their relative cryptographic security
|
static java.util.Comparator<DigestAlgorithm> |
COMPARE_PREFER_SECURE
The comparator to use when comparing algorithms & preferring secure algorithms (will usually be the same as the default
comparator, but preferring algorithms marked cryptographically secure)
|
| Modifier and Type | Method and Description |
|---|---|
static DigestAlgorithm |
getBest(boolean prioritiseSecure,
DigestAlgorithm... algorithms)
Determines the best algorithm from a list of choices
|
static DigestAlgorithm |
getBest(boolean prioritiseSecure,
java.lang.Iterable<DigestAlgorithm> algorithms)
Determines the "best" algorithm from a list of choices
|
IDigester |
getImplementation()
Retrieves the implementation of this algorithm
|
int |
getPriority() |
boolean |
isAvailable()
Determines whether this algorithm is available for use
|
boolean |
isBlacklisted()
Determines whether this algorithm has been blacklisted.
Blacklisted algorithms must not be used |
boolean |
isCryptographicallySecure() |
void |
setDefaultImplementation(IDigester digester)
Set the default implementation for an algorithm; this will be used if no other implementations are registered
|
void |
setImplementation(IDigester digester)
Set a new implementation
|
void |
setImplementation(IDigester digester,
int implPriority)
Set the implementation, permitted that no other implementations have attempted to register with a higher priority
|
static DigestAlgorithm |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static DigestAlgorithm[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DigestAlgorithm LENGTH
public static final DigestAlgorithm CRC32
public static final DigestAlgorithm MD2
public static final DigestAlgorithm MD5
public static final DigestAlgorithm SHA1
public static final DigestAlgorithm SHA256
public static final DigestAlgorithm SHA512
public static final java.util.Comparator<DigestAlgorithm> COMPARE
public static final java.util.Comparator<DigestAlgorithm> COMPARE_PREFER_SECURE
public static DigestAlgorithm[] values()
for (DigestAlgorithm c : DigestAlgorithm.values()) System.out.println(c);
public static DigestAlgorithm 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 boolean isCryptographicallySecure()
public int getPriority()
public boolean isBlacklisted()
public boolean isAvailable()
public void setDefaultImplementation(IDigester digester)
digester - public void setImplementation(IDigester digester, int implPriority)
digester - public void setImplementation(IDigester digester)
digester - public IDigester getImplementation()
public static DigestAlgorithm getBest(boolean prioritiseSecure, DigestAlgorithm... algorithms)
prioritiseSecure - if true, cryptographically secure algorithms will be prioritisedalgorithms - The algorithmspublic static DigestAlgorithm getBest(boolean prioritiseSecure, java.lang.Iterable<DigestAlgorithm> algorithms)
prioritiseSecure - if true, cryptographically secure algorithms will be prioritisedalgorithms - The algorithmsCopyright © 2014. All Rights Reserved.