org.apache.commons.codec.digest
Class DigestUtils
Operations to simplifiy common java.security.MessageDigest
tasks. This
class is thread safe.
- Apache Software Foundation
(package private) static MessageDigest | getDigest(java.lang.String algorithm) - Returns a MessageDigest for the given
algorithm .
|
private static MessageDigest | getMd5Digest() - Returns an MD5 MessageDigest.
|
private 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(java.lang.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(java.lang.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(java.lang.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(java.lang.String data) - Calculates the SHA digest and returns the value as a hex string.
|
getDigest
(package private) static MessageDigest getDigest(java.lang.String algorithm)
Returns a MessageDigest for the given algorithm
.
algorithm
- The MessageDigest algorithm name.
- An MD5 digest instance.
getMd5Digest
private static MessageDigest getMd5Digest()
Returns an MD5 MessageDigest.
- An MD5 digest instance.
getShaDigest
private static MessageDigest getShaDigest()
Returns an SHA digest.
- An SHA digest instance.
md5
public static byte[] md5(byte[] data)
Calculates the MD5 digest and returns the value as a 16 element
byte[]
.
data
- Data to digest
- MD5 digest
md5
public static byte[] md5(java.lang.String data)
Calculates the MD5 digest and returns the value as a 16 element
byte[]
.
data
- Data to digest
- MD5 digest
md5Hex
public static String md5Hex(byte[] data)
Calculates the MD5 digest and returns the value as a 32 character
hex string.
data
- Data to digest
- MD5 digest as a hex string
md5Hex
public static String md5Hex(java.lang.String data)
Calculates the MD5 digest and returns the value as a 32 character
hex string.
data
- Data to digest
- MD5 digest as a hex string
sha
public static byte[] sha(byte[] data)
Calculates the SHA digest and returns the value as a
byte[]
.
data
- Data to digest
- SHA digest
sha
public static byte[] sha(java.lang.String data)
Calculates the SHA digest and returns the value as a
byte[]
.
data
- Data to digest
- SHA digest
shaHex
public static String shaHex(byte[] data)
Calculates the SHA digest and returns the value as a hex string.
data
- Data to digest
- SHA digest as a hex string
shaHex
public static String shaHex(java.lang.String data)
Calculates the SHA digest and returns the value as a hex string.
data
- Data to digest
- SHA digest as a hex string
commons-codec version 1.3 - Copyright © 2002-2004 - Apache Software Foundation