org.apache.commons.codec.digest
public class DigestUtils extends Object
Method Summary | |
---|---|
static MessageDigest | getDigest(String algorithm)
Returns a MessageDigest for the given algorithm .
|
static MessageDigest | getMd5Digest()
Returns an MD5 MessageDigest.
|
static MessageDigest | getShaDigest()
Returns an SHA digest.
|
static byte[] | md5(byte[] data)
Calculates the MD5 digest and returns the value as a 16 element
byte[] .
|
static byte[] | md5(String data)
Calculates the MD5 digest and returns the value as a 16 element
byte[] .
|
static String | md5Hex(byte[] data)
Calculates the MD5 digest and returns the value as a 32 character
hex string.
|
static String | md5Hex(String data)
Calculates the MD5 digest and returns the value as a 32 character
hex string.
|
static byte[] | sha(byte[] data)
Calculates the SHA digest and returns the value as a
byte[] .
|
static byte[] | sha(String data)
Calculates the SHA digest and returns the value as a
byte[] .
|
static String | shaHex(byte[] data)
Calculates the SHA digest and returns the value as a hex string.
|
static String | shaHex(String data)
Calculates the SHA digest and returns the value as a hex string.
|
algorithm
.
Parameters: algorithm The MessageDigest algorithm name.
Returns: An MD5 digest instance.
Throws: RuntimeException when a {@link java.security.NoSuchAlgorithmException} is caught,
Returns: An MD5 digest instance.
Throws: RuntimeException when a {@link java.security.NoSuchAlgorithmException} is caught,
Returns: An SHA digest instance.
Throws: RuntimeException when a {@link java.security.NoSuchAlgorithmException} is caught,
byte[]
.
Parameters: data Data to digest
Returns: MD5 digest
byte[]
.
Parameters: data Data to digest
Returns: MD5 digest
Parameters: data Data to digest
Returns: MD5 digest as a hex string
Parameters: data Data to digest
Returns: MD5 digest as a hex string
byte[]
.
Parameters: data Data to digest
Returns: SHA digest
byte[]
.
Parameters: data Data to digest
Returns: SHA digest
Parameters: data Data to digest
Returns: SHA digest as a hex string
Parameters: data Data to digest
Returns: SHA digest as a hex string