grHMACHashString function

String grHMACHashString(
  1. GRCryptoTypeHMAC type,
  2. String input,
  3. String key
)

This method takes two parameters,

• type: This should be of type GRCryptoType

• input: This should be of type String

• key: This should be of type String

Returns: A value of type String

Usage: Encrypts the input String value to a specific CryptoType with a key and return as a String. This is a one-sided encryption and can't be decrypted.

Example: To covert "Hello GaiNeR" to SHA224 with key "Password", we have to write like this,

String hashValue = grHMACHashString(CryptoTypes.sha224, "Hello GaiNeR", "Password");

Implementation

String grHMACHashString(GRCryptoTypeHMAC type, String input, String key) {
  return getHash(input, key, type);
}