thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Security Fundamentals & Crypto · Intermediate

Hash-Based Message Authentication Code (HMAC)

MAC construction that combines a cryptographic hash function with a secret key (RFC 2104).

Definition

HMAC hashes the message with the key in a nested structure that resists length-extension attacks. It is used in TLS 1.2, IPsec, JWT (HS256), API authentication, and one-time password algorithms. Its security depends on the hash and the key's secrecy.

Example

TOTP codes are derived from HMAC-SHA1 of the current time step and a shared secret.

Exam tip

HMAC provides integrity and authentication; signatures add non-repudiation.

Don't confuse it with

Related terms