Explain HMAC (Hash-based Message Authentication Code).

Updated Apr 28, 2026

Short answer

A specific type of MAC involving a cryptographic hash function and a secret cryptographic key.

Deep explanation

Mid-level cryptography moves into protocol design and implementation details. Understanding how primitives like Diffie-Hellman combine with AES to create a secure channel is key.

Real-world example

VPNs use Diffie-Hellman to establish a shared secret without ever sending the secret key over the wire.

Common mistakes

  • Reusing an Initialization Vector (IV) with the same key in AES-GCM.

Follow-up questions

  • What is the difference between AES-CBC and AES-GCM?
  • Why is RSA slower than AES?

More Cryptography interview questions

View all →