public class DigestUtils extends java.lang.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(java.io.InputStream 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 java.lang.String |
md5Hex(byte[] data)
Calculates the MD5 digest and returns the value as a 32 character hex string.
|
static java.lang.String |
md5Hex(java.io.InputStream data)
Calculates the MD5 digest and returns the value as a 32 character hex string.
|
static java.lang.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-1 digest and returns the value as a
byte[]. |
static byte[] |
sha(java.io.InputStream data)
Calculates the SHA-1 digest and returns the value as a
byte[]. |
static byte[] |
sha(java.lang.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(java.io.InputStream data)
Calculates the SHA-256 digest and returns the value as a
byte[]. |
static byte[] |
sha256(java.lang.String data)
Calculates the SHA-256 digest and returns the value as a
byte[]. |
static java.lang.String |
sha256Hex(byte[] data)
Calculates the SHA-256 digest and returns the value as a hex string.
|
static java.lang.String |
sha256Hex(java.io.InputStream data)
Calculates the SHA-256 digest and returns the value as a hex string.
|
static java.lang.String |
sha256Hex(java.lang.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(java.io.InputStream data)
Calculates the SHA-384 digest and returns the value as a
byte[]. |
static byte[] |
sha384(java.lang.String data)
Calculates the SHA-384 digest and returns the value as a
byte[]. |
static java.lang.String |
sha384Hex(byte[] data)
Calculates the SHA-384 digest and returns the value as a hex string.
|
static java.lang.String |
sha384Hex(java.io.InputStream data)
Calculates the SHA-384 digest and returns the value as a hex string.
|
static java.lang.String |
sha384Hex(java.lang.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(java.io.InputStream data)
Calculates the SHA-512 digest and returns the value as a
byte[]. |
static byte[] |
sha512(java.lang.String data)
Calculates the SHA-512 digest and returns the value as a
byte[]. |
static java.lang.String |
sha512Hex(byte[] data)
Calculates the SHA-512 digest and returns the value as a hex string.
|
static java.lang.String |
sha512Hex(java.io.InputStream data)
Calculates the SHA-512 digest and returns the value as a hex string.
|
static java.lang.String |
sha512Hex(java.lang.String data)
Calculates the SHA-512 digest and returns the value as a hex string.
|
static java.lang.String |
shaHex(byte[] data)
Calculates the SHA-1 digest and returns the value as a hex string.
|
static java.lang.String |
shaHex(java.io.InputStream data)
Calculates the SHA-1 digest and returns the value as a hex string.
|
static java.lang.String |
shaHex(java.lang.String data)
Calculates the SHA-1 digest and returns the value as a hex string.
|
public DigestUtils()
public static byte[] md5(byte[] data)
byte[].data - Data to digestpublic static byte[] md5(java.io.InputStream data) throws java.io.IOException
byte[].data - Data to digestjava.io.IOException - On error reading from the streampublic static byte[] md5(java.lang.String data)
byte[].data - Data to digestpublic static java.lang.String md5Hex(byte[] data)
data - Data to digestpublic static java.lang.String md5Hex(java.io.InputStream data) throws java.io.IOException
data - Data to digestjava.io.IOException - On error reading from the streampublic static java.lang.String md5Hex(java.lang.String data)
data - Data to digestpublic static byte[] sha(byte[] data)
byte[].data - Data to digestpublic static byte[] sha(java.io.InputStream data) throws java.io.IOException
byte[].data - Data to digestjava.io.IOException - On error reading from the streampublic static byte[] sha(java.lang.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(java.io.InputStream data) throws java.io.IOException
byte[].
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestjava.io.IOException - On error reading from the streampublic static byte[] sha256(java.lang.String data)
byte[].
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestpublic static java.lang.String sha256Hex(byte[] data)
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestpublic static java.lang.String sha256Hex(java.io.InputStream data) throws java.io.IOException
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestjava.io.IOException - On error reading from the streampublic static java.lang.String sha256Hex(java.lang.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(java.io.InputStream data) throws java.io.IOException
byte[].
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestjava.io.IOException - On error reading from the streampublic static byte[] sha384(java.lang.String data)
byte[].
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestpublic static java.lang.String sha384Hex(byte[] data)
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestpublic static java.lang.String sha384Hex(java.io.InputStream data) throws java.io.IOException
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestjava.io.IOException - On error reading from the streampublic static java.lang.String sha384Hex(java.lang.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(java.io.InputStream data) throws java.io.IOException
byte[].
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestjava.io.IOException - On error reading from the streampublic static byte[] sha512(java.lang.String data)
byte[].
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestpublic static java.lang.String sha512Hex(byte[] data)
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestpublic static java.lang.String sha512Hex(java.io.InputStream data) throws java.io.IOException
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestjava.io.IOException - On error reading from the streampublic static java.lang.String sha512Hex(java.lang.String data)
Throws a RuntimeException on JRE versions prior to 1.4.0.
data - Data to digestpublic static java.lang.String shaHex(byte[] data)
data - Data to digestpublic static java.lang.String shaHex(java.io.InputStream data) throws java.io.IOException
data - Data to digestjava.io.IOException - On error reading from the streampublic static java.lang.String shaHex(java.lang.String data)
data - Data to digestCopyright © 2002-2014 The Apache Software Foundation. All Rights Reserved.