|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dyuproject.util.DigestUtil
public final class DigestUtil
Util for digesting and encoding bytes/strings.
Field Summary | |
---|---|
static byte[] |
HEXADECIMAL
The hex chars as bytes. |
static String |
MD5
"MD5" |
static String |
SHA1
"SHA-1" |
static String |
SHA256
"SHA-256" |
Constructor Summary | |
---|---|
DigestUtil()
|
Method Summary | |
---|---|
static String |
digestMD5(String data)
Digests the data with MD5 and returns the raw unencoded bytes. |
static String |
digestMD5(String data,
String charset)
Digests the data with MD5 and the specified charset and
returns the raw unencoded bytes. |
static String |
digestSHA1(String data)
Digests the data with SHA-1 and returns the raw unencoded bytes. |
static String |
digestSHA1(String data,
String charset)
Digests the data with SHA-1 and the specified charset and
returns the raw unencoded bytes. |
static String |
digestSHA256(String data)
Digests the data with SHA-256 and returns the raw unencoded bytes. |
static String |
digestSHA256(String data,
String charset)
Digests the data with SHA-256 and the specified charset and
returns the raw unencoded bytes. |
static String |
getDigestedValue(String type,
String data)
Digests the data with the specified type . |
static String |
getDigestedValue(String type,
String data,
String charset)
Digests the data with the specified type and charset . |
static byte[] |
getHexBytes(byte[] data)
Returns the bytes data in hex form. |
static char[] |
getHexChars(byte[] data)
Returns the bytes data in hex form as characters. |
static String |
getHexString(byte[] data,
String charset)
Returns the bytes data in hex form as string. |
static byte[] |
getPlainDigestedValue(String type,
byte[] data)
Digests the data with the specified type and returns the
raw unencoded bytes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String MD5
public static final String SHA1
public static final String SHA256
public static final byte[] HEXADECIMAL
Constructor Detail |
---|
public DigestUtil()
Method Detail |
---|
public static byte[] getHexBytes(byte[] data)
data
in hex form.
public static char[] getHexChars(byte[] data)
data
in hex form as characters.
public static String getHexString(byte[] data, String charset) throws UnsupportedEncodingException
data
in hex form as string.
UnsupportedEncodingException
public static String getDigestedValue(String type, String data, String charset) throws UnsupportedEncodingException
data
with the specified type
and charset
.
UnsupportedEncodingException
public static String getDigestedValue(String type, String data)
data
with the specified type
.
public static byte[] getPlainDigestedValue(String type, byte[] data)
data
with the specified type
and returns the
raw unencoded bytes.
public static String digestMD5(String data)
data
with MD5 and returns the raw unencoded bytes.
public static String digestMD5(String data, String charset)
data
with MD5 and the specified charset
and
returns the raw unencoded bytes.
public static String digestSHA1(String data)
data
with SHA-1 and returns the raw unencoded bytes.
public static String digestSHA1(String data, String charset)
data
with SHA-1 and the specified charset
and
returns the raw unencoded bytes.
public static String digestSHA256(String data)
data
with SHA-256 and returns the raw unencoded bytes.
public static String digestSHA256(String data, String charset)
data
with SHA-256 and the specified charset
and
returns the raw unencoded bytes.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |