Generate RFC2104 HMAC Compliant Signature

HMAC is a mechanism for message authentication using cryptographic hash functions.

This HMAC function uses the iterative cryptographic hash functions SHA-1,SHA256,SHA384,SHA526 with a secret shared key. If there is no hash function defined, the default hash fuction is SHA-1.

Use this function to generate a digital signature that is compliant with HMAC.

Parameter: data (type=string)

The information or message to be validated.

Parameter: key (type=string)

The key used to validate the data.

Parameter: encoding (type=string)

The encoding to apply to the data and key. This can be one of:
  • US-ASCII - Seven-bit ASCII. Also called ISO646-US. The Basic Latin block of the Unicode character set.
  • ISO-8859-1 - ISO Latin Alphabet No. 1. Also called ISO-LATIN-1.
  • UTF-8 - Eight-bit UCS Transformation Format.
  • UTF-16BE - Sixteen-bit UCS Transformation Format, big-endian byte order.
  • UTF-16LE - Sixteen-bit UCS Transformation Format, little-endian byte order.
  • UTF-16 - Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark.

Returns: HMAC signature (type string)

The generated HMAC signature in UTF-8 encoding.