public enum DigestAlgorithm extends Enum<DigestAlgorithm>
Enum Constant and Description |
---|
MD5
MD5 Message-Digest Algorithm (128 bits)
|
SHA1
Secure Hash Algorithm 1 (160 bits)
|
SHA256
Secure Hash Algorithm 2 (256 bits)
|
SHA384
Secure Hash Algorithm 2 (384 bits)
|
SHA512
Secure Hash Algorithm 2 (512 bits)
|
Modifier and Type | Field and Description |
---|---|
String |
id
The JCE name of the algorithm
|
ASN1ObjectIdentifier |
oid
The object identifier of the algorithm
|
Modifier and Type | Method and Description |
---|---|
static DigestAlgorithm |
getDefault()
Return the default algorithm (currently SHA-256, SHA-1 has been deprecated since January 1st 2016).
|
MessageDigest |
getMessageDigest()
Return a MessageDigest for this algorithm.
|
static DigestAlgorithm |
of(ASN1ObjectIdentifier oid)
Return the algorithm matching the specified object identifier.
|
static DigestAlgorithm |
of(String name)
Parse the specified value and returns the corresponding digest algorithm.
|
static DigestAlgorithm |
valueOf(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 MD5
public static final DigestAlgorithm SHA1
public static final DigestAlgorithm SHA256
public static final DigestAlgorithm SHA384
public static final DigestAlgorithm SHA512
public final ASN1ObjectIdentifier oid
public static DigestAlgorithm getDefault()
SHA256
)public MessageDigest getMessageDigest()
public static DigestAlgorithm of(ASN1ObjectIdentifier oid)
oid
- the ASN.1 object identifier of the algorithmnull
if none matches the specified oidpublic static DigestAlgorithm of(String name)
valueOf(String)
, it's case
insensitive and ignores hyphens.name
- the name of the digest algorithmnull
if the name specified doesn't match any supported algorithmpublic static DigestAlgorithm valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static DigestAlgorithm[] values()
for (DigestAlgorithm c : DigestAlgorithm.values()) System.out.println(c);
Copyright © 2012–2025. All rights reserved.