public class HMAC
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
byteArrayToHex(byte[] a)
Convert a byte array to a hex string of the format
"1f 30 b7".
|
static java.lang.String |
md5(java.lang.String text,
java.lang.String key)
Generate an HMAC hash for the given text and key using MD5 as the
hash function.
|
static java.lang.String |
sha1(java.lang.String text,
java.lang.String key)
Generate an HMAC hash for the given text and key using SHA1 as the
hash function.
|
public static java.lang.String byteArrayToHex(byte[] a)
a
- The byte array to convertpublic static java.lang.String sha1(java.lang.String text, java.lang.String key)
text
- The text to hashkey
- The key to use when generating the hash.public static java.lang.String md5(java.lang.String text, java.lang.String key)
text
- The text to hashkey
- The key to use when generating the hash.