7.4. Hash-Based Message Authentication Code (HMAC)

HMAC generates a MAC given a 16 byte (128-bit) symmetric key and a message.

Functions:

HMACEval(key []byte, msg []byte) ([]byte, error)

Compute a HMAC-SHA512 of the message.

Parameters
  • key ([]byte) – 16-byte symmetric MAC key

  • msg ([]byte) – Arbitrary-length message to HMAC

Returns

64-byte HMAC

Return type

[]byte, error

HMACEqual(a []byte, b []byte) (bool)

Compare whether two MACs are the same in a constant-time manner.

Parameters
  • a – First MAC

  • b – Second MAC

Return type

bool