public class DigestUtils extends Object
Modifier and Type | Method and Description |
---|---|
static char[] |
digest(char[] target,
String algorithm)
Returns the digest of the target string.
|
static String |
digest(String target,
String algorithm)
Returns the digest of the target string.
|
static byte[] |
toHMacSha1(String source,
byte[] secretKey)
Converts a source string to its HMAC/SHA-1 value.
|
static byte[] |
toHMacSha1(String source,
String secretKey)
Converts a source string to its HMAC/SHA-1 value.
|
static byte[] |
toHMacSha256(String source,
byte[] secretKey)
Converts a source string to its HMAC/SHA256 value.
|
static byte[] |
toHMacSha256(String source,
String secretKey)
Converts a source string to its HMAC/SHA256 value.
|
static String |
toHttpDigest(String identifier,
char[] secret,
String realm)
Return the HTTP DIGEST hashed secret.
|
static String |
toMd5(String target)
Returns the MD5 digest of the target string.
|
static String |
toMd5(String target,
String charsetName)
Returns the MD5 digest of target string.
|
static String |
toSha1(String target)
Returns the SHA1 digest of the target string.
|
static String |
toSha1(String target,
String charsetName)
Returns the SHA1 digest of target string.
|
public static char[] digest(char[] target, String algorithm)
target
- The string to encode.algorithm
- The digest algorithm to use.public static String digest(String target, String algorithm)
target
- The string to encode.algorithm
- The digest algorithm to use.public static byte[] toHMacSha1(String source, byte[] secretKey)
source
- The source string to convert.secretKey
- The secret key to use for conversion.public static byte[] toHMacSha1(String source, String secretKey)
source
- The source string to convert.secretKey
- The secret key to use for conversion.public static byte[] toHMacSha256(String source, byte[] secretKey)
source
- The source string to convert.secretKey
- The secret key to use for conversion.public static byte[] toHMacSha256(String source, String secretKey)
source
- The source string to convert.secretKey
- The secret key to use for conversion.public static String toHttpDigest(String identifier, char[] secret, String realm)
identifier
- The user identifier to hash.secret
- The user secret.realm
- The authentication realm.public static String toMd5(String target)
target
- The string to encode.public static String toMd5(String target, String charsetName) throws UnsupportedEncodingException
target
- The string to encode.charsetName
- The character set.UnsupportedEncodingException
public static String toSha1(String target)
target
- The string to encode.public static String toSha1(String target, String charsetName) throws UnsupportedEncodingException
target
- The string to encode.charsetName
- The character set.UnsupportedEncodingException
Copyright © 2005–2014. All rights reserved.