Package com.vonage.client.auth.hashutils
Class HashUtil
java.lang.Object
com.vonage.client.auth.hashutils.HashUtil
Utility methods for hashing strings.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringcalculate(String input, HashUtil.HashType hashType) Deprecated.This will be removed in the next major release.static Stringcalculate(String input, String encoding, HashUtil.HashType hashType) Deprecated.This will be removed in the next major release.static Stringcalculate(String input, String secretKey, String encoding, HashUtil.HashType hashType) Calculates hash for string.
-
Constructor Details
-
HashUtil
public HashUtil()
-
-
Method Details
-
calculate
@Deprecated public static String calculate(String input, HashUtil.HashType hashType) throws NoSuchAlgorithmException, InvalidKeyException Deprecated.This will be removed in the next major release.Calculates hash for string. assume string is UTF-8 encoded.- Parameters:
input- string which is going to be encoded into requested formathashType- The type of hash to be applied to the input string- Returns:
- representation of the input string with given hash type
- Throws:
NoSuchAlgorithmException- if the algorithm is not available.InvalidKeyException- Only applicable to HMAC encoding types, when a bad key is provided.
-
calculate
@Deprecated public static String calculate(String input, String encoding, HashUtil.HashType hashType) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException Deprecated.This will be removed in the next major release.Calculates hash for string.- Parameters:
input- string which is going to be encoded into requested formatencoding- encoding type of inputhashType- The type of hash to be applied to the input string- Returns:
- representation of the input string with given hash type
- Throws:
NoSuchAlgorithmException- if the algorithm is not available.InvalidKeyException- Only applicable to HMAC encoding types, when a bad key is provided.UnsupportedEncodingException- if the specified encoding is unavailable.
-
calculate
public static String calculate(String input, String secretKey, String encoding, HashUtil.HashType hashType) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException Calculates hash for string.- Parameters:
input- string which is going to be encoded into requested formatsecretKey- the key to be used for encodingencoding- character encoding of the string which is going to be encoded into requested formathashType- The type of hash to be applied to the input string- Returns:
- representation of the input string with given hash type
- Throws:
NoSuchAlgorithmException- if the algorithm is not available.UnsupportedEncodingException- if the specified encoding is unavailable.InvalidKeyException- Only applicable to HMAC encoding types, when a bad key is provided.
-