Skip to main content Link Search Menu Expand Document (external link)

6.4 Hash-Based Message Authentication Code (HMAC)


Functions

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

Compute a 64-byte HMAC-SHA512 of the message.

Parameters
key ([]byte) - 16-byte symmetric MAC key
msg ([]byte) - arbitrary-length message to HMAC

Returns
sum ([]byte) - a 64-byte HMAC


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

Compare whether two MACs (or hashes) are the same in a constant-time manner.

Parameters
a ([]byte) - first MAC
b ([]byte) - second MAC

Returns
equal (bool)