public class DigestUtils extends Object
MessageDigest
tasks. This class is thread safe.Constructor and Description |
---|
DigestUtils() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
md5(byte[] data)
Calculates the MD5 digest and returns the value as a 16 element
byte[] . |
static byte[] |
md5(InputStream 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(InputStream 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-1 digest and returns the value as a
byte[] . |
static byte[] |
sha(InputStream data)
Calculates the SHA-1 digest and returns the value as a
byte[] . |
static byte[] |
sha(String data)
Calculates the SHA-1 digest and returns the value as a
byte[] . |
static byte[] |
sha256(byte[] data)
Calculates the SHA-256 digest and returns the value as a
byte[] . |
static byte[] |
sha256(InputStream data)
Calculates the SHA-256 digest and returns the value as a
byte[] . |
static byte[] |
sha256(String data)
Calculates the SHA-256 digest and returns the value as a
byte[] . |
static String |
sha256Hex(byte[] data)
Calculates the SHA-256 digest and returns the value as a hex string.
|
static String |
sha256Hex(InputStream data)
Calculates the SHA-256 digest and returns the value as a hex string.
|
static String |
sha256Hex(String data)
Calculates the SHA-256 digest and returns the value as a hex string.
|
static byte[] |
sha384(byte[] data)
Calculates the SHA-384 digest and returns the value as a
byte[] . |
static byte[] |
sha384(InputStream data)
Calculates the SHA-384 digest and returns the value as a
byte[] . |
static byte[] |
sha384(String data)
Calculates the SHA-384 digest and returns the value as a
byte[] . |
static String |
sha384Hex(byte[] data)
Calculates the SHA-384 digest and returns the value as a hex string.
|
static String |
sha384Hex(InputStream data)
Calculates the SHA-384 digest and returns the value as a hex string.
|
static String |
sha384Hex(String data)
Calculates the SHA-384 digest and returns the value as a hex string.
|
static byte[] |
sha512(byte[] data)
Calculates the SHA-512 digest and returns the value as a
byte[] . |
static byte[] |
sha512(InputStream data)
Calculates the SHA-512 digest and returns the value as a
byte[] . |
static byte[] |
sha512(String data)
Calculates the SHA-512 digest and returns the value as a
byte[] . |
static String |
sha512Hex(byte[] data)
Calculates the SHA-512 digest and returns the value as a hex string.
|
static String |
sha512Hex(InputStream data)
Calculates the SHA-512 digest and returns the value as a hex string.
|
static String |
sha512Hex(String data)
Calculates the SHA-512 digest and returns the value as a hex string.
|
static String |
shaHex(byte[] data)
Calculates the SHA-1 digest and returns the value as a hex string.
|
static String |
shaHex(InputStream data)
Calculates the SHA-1 digest and returns the value as a hex string.
|
static String |
shaHex(String data)
Calculates the SHA-1 digest and returns the value as a hex string.
|
public static byte[] md5(byte[] data)
byte[]
.data
- Data to digestpublic static byte[] md5(InputStream data) throws IOException
byte[]
.data
- Data to digestIOException
- On error reading from the streampublic static byte[] md5(String data)
byte[]
.data
- Data to digestpublic static String md5Hex(byte[] data)
data
- Data to digestpublic static String md5Hex(InputStream data) throws IOException
data
- Data to digestIOException
- On error reading from the streampublic static String md5Hex(String data)
data
- Data to digestpublic static byte[] sha(byte[] data)
byte[]
.data
- Data to digestpublic static byte[] sha(InputStream data) throws IOException
byte[]
.data
- Data to digestIOException
- On error reading from the streampublic static byte[] sha(String data)
byte[]
.data
- Data to digestpublic static byte[] sha256(byte[] data)
byte[]
.
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static byte[] sha256(InputStream data) throws IOException
byte[]
.
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestIOException
- On error reading from the streampublic static byte[] sha256(String data)
byte[]
.
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static String sha256Hex(byte[] data)
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static String sha256Hex(InputStream data) throws IOException
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestIOException
- On error reading from the streampublic static String sha256Hex(String data)
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static byte[] sha384(byte[] data)
byte[]
.
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static byte[] sha384(InputStream data) throws IOException
byte[]
.
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestIOException
- On error reading from the streampublic static byte[] sha384(String data)
byte[]
.
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static String sha384Hex(byte[] data)
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static String sha384Hex(InputStream data) throws IOException
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestIOException
- On error reading from the streampublic static String sha384Hex(String data)
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static byte[] sha512(byte[] data)
byte[]
.
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static byte[] sha512(InputStream data) throws IOException
byte[]
.
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestIOException
- On error reading from the streampublic static byte[] sha512(String data)
byte[]
.
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static String sha512Hex(byte[] data)
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static String sha512Hex(InputStream data) throws IOException
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestIOException
- On error reading from the streampublic static String sha512Hex(String data)
Throws a RuntimeException
on JRE versions prior to 1.4.0.
data
- Data to digestpublic static String shaHex(byte[] data)
data
- Data to digestpublic static String shaHex(InputStream data) throws IOException
data
- Data to digestIOException
- On error reading from the streamCopyright © 2002-2012 Apache Software Foundation. All Rights Reserved.