java.lang.Object
org.seppiko.commons.utils.codec.HashCryptUtil
Hash Crypt Util
- Author:
- Leonard Woo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]hmacCrypt(HmacAlgorithms algorithm, byte[] data, byte[] key) Simplifies commonMactasks.static byte[]mdCrypt(MessageDigestAlgorithms algorithm, byte[] data) Simplifies commonMessageDigesttasks.
-
Constructor Details
-
HashCryptUtil
public HashCryptUtil()
-
-
Method Details
-
mdCrypt
public static byte[] mdCrypt(MessageDigestAlgorithms algorithm, byte[] data) throws IllegalArgumentException Simplifies commonMessageDigesttasks.- Parameters:
algorithm- Message Digest Algorithmdata- data to hash- Returns:
- complete hash value
- Throws:
IllegalArgumentException- when aNoSuchAlgorithmExceptionis caught.
-
hmacCrypt
public static byte[] hmacCrypt(HmacAlgorithms algorithm, byte[] data, byte[] key) throws InvalidKeyException, IllegalArgumentException Simplifies commonMactasks.- Parameters:
algorithm- Hmac Algorithmdata- data to hash with keykey- the keyed digest- Returns:
- complete hash value including key
- Throws:
InvalidKeyException- if the given key isnullor does not match the allowed pattern.IllegalArgumentException- when aNoSuchAlgorithmExceptionis caught.
-