Explore the fascinating world of Message Authentication Codes built on cryptographic hash functions. Learn, interact, and master the concepts that secure our digital communications.
A Message Authentication Code (MAC) is a cryptographic checksum that provides both data integrity and authentication. It ensures that a message hasn't been tampered with and verifies the identity of the sender.
Original data to be authenticated
Shared between sender & receiver
Combines message + key
Authentication code
MACs are essential for secure communication protocols like TLS, IPSec, and many others. They provide assurance that the message came from someone who knows the secret key and that the message hasn't been modified in transit.
The most widely used hash-based MAC, defined in RFC 2104. HMAC can work with any cryptographic hash function and provides strong security guarantees.
The predecessor to HMAC, using nested hash function calls. Less practical but theoretically important.
Based on the SHA-3 family, providing variable-length output and enhanced security features.
Try generating HMAC values with different inputs to see how the algorithm works in practice.
| Property | Description | Importance |
|---|---|---|
| Unforgeability | Cannot create valid MAC without the secret key | Critical |
| Collision Resistance | Hard to find two messages with same MAC | High |
| Key Recovery Resistance | MAC values don't reveal the secret key | Critical |
| Deterministic | Same input always produces same output | Essential |
| Efficient | Fast computation for practical use | Medium |
TLS/SSL protocols use HMAC for message authentication in secure web communications, ensuring data integrity during transmission.
REST APIs use HMAC signatures to verify request authenticity, preventing unauthorized access and tampering.
File systems and databases use MACs to detect unauthorized modifications to stored data.
HMAC is used in password-based key derivation functions (PBKDF2) for secure password hashing.