HMAC (hash-based message authentication code)
A message authentication code built from a cryptographic hash function and a shared secret key (RFC 2104, FIPS 198-1), giving integrity and data origin authentication but not non-repudiation.
HMAC is the standard construction for building a message authentication code from a cryptographic hash function, defined in RFC 2104 and in NIST FIPS 198-1. The sender and receiver share a secret key. HMAC hashes the message with the key in two nested passes, each combining the key with a different fixed padding, and sends the result as a tag. The receiver recomputes the tag with the same key; a match shows that the message was not altered and that it came from a holder of the key. HMAC-SHA-256 is HMAC built on SHA-256.
HMAC sits between plain hashing and a digital signature. A bare hash detects accidental change, but an attacker who alters the message can simply recompute it; HMAC adds the key, so only key holders can produce a valid tag. Because both parties hold the same key, either could have produced the tag, so HMAC does not provide non-repudiation, which needs a signature made with a private key. The nested design also resists the length-extension weakness of naive keyed-hash constructions. Uses include TLS key derivation, IPsec integrity and HMAC-based one-time passwords.
Exam relevance: a scenario needing integrity and authenticity between two parties who share a key is likely to point to HMAC. Candidates are expected to recognise that a shared key rules out non-repudiation.