Message authentication code
A message authentication code is a keyed cryptographic value generated from a message to verify its integrity and authenticity.
Hacking Cryptography
An authentication tag is a value generated from a message and authentication key that enables verification of message integrity and key-based authenticity.
- How it is used
- Authenticates API requests and recovery links by letting shared-secret holders verify message integrity and origin.
- How deep it goes
- Works through secret-prefix API implementation and a SHA-256 length-extension exploit, then contrasts suffix MACs and HMAC.
- Examples
- Uses password-reset URLs, a shared-secret bank transaction API, and a forged SHA-256 request with amount 424242.
- What you can do after
- Evaluate/understand unsafe hash-based MAC constructions and choose HMAC or authenticated encryption instead.
Read how Hacking Cryptography explains message authentication code →
Software Security for Developers
A message authentication code is a keyed value that enables verification of a message's integrity and origin.
- How it is used
- Protects messages and encrypted payloads against tampering while authenticating a party that holds the shared secret.
- How deep it goes
- Explains keyed verification, exchange steps, hash contrast, and unsafe key concatenation, but avoids mathematical proofs and protocol internals.
- Examples
- Uses warehouse refunds, modified files, TLS tampering, and authenticated headers with encrypted bodies as concrete examples.
- What you can do after
- Diagnose tampering and apply keyed integrity checks when designing service-to-service messages or protected payloads.
Read how Software Security for Developers explains message authentication code →
Real-World Cryptography
An authentication tag is the deterministic output of a keyed authentication function used to verify a message's integrity and authenticity.
- How it is used
- Protects message integrity and authenticity between parties sharing a secret key, including cookies and cleartext or encrypted communications.
- How deep it goes
- Explains keyed tags, forgery, tag length, replay, timing attacks, HMAC, and KMAC, while deferring formal proof details.
- Examples
- Uses stateless cookies, two-party messages, Rust HMAC code, replay counters, and constant-time comparison code.
- What you can do after
- Apply HMAC to authenticate messages and verify tags safely while accounting for replay, serialization, length, and timing risks.
Read how Real-World Cryptography explains message authentication code →
Secure APIs
An authentication tag is cryptographic output used to verify the integrity and authenticity of authenticated-encrypted data.
- How it is used
- Uses the authentication tag to validate encrypted data and protected additional data.
- How deep it goes
- Defines the tag and identifies protected JWE components, without deriving its cryptographic construction.
- Examples
- Uses JWE field layouts and a protected JOSE header to illustrate where the authentication tag appears.
- What you can do after
- Evaluate whether encrypted data and associated protected data retain their integrity.
Also covered in
What to know first
- digital signatureA digital signature is a cryptographic value associated with data that can be verified to provide evidence of the data’s origin and integrity.
- hash functionA hash function is a deterministic function that maps input data to a hash value, typically of fixed size, for uses such as lookup, indexing, comparison, or integrity checking.
- SHA-2SHA-2 is a standardized family of cryptographic hash algorithms that produces fixed-length digests, including SHA-224, SHA-256, SHA-384, and SHA-512.
- AESAES is a standardized symmetric block cipher that encrypts and decrypts data in 128-bit blocks using 128-, 192-, or 256-bit keys.
Related concepts
- HMACincludes · HMAC is a keyed message authentication code constructed from a cryptographic hash function and a secret key to authenticate data and verify its integrity.
- API keyuses · An API key is a credential, usually represented as a string or token, presented with API requests to identify or authenticate a client and potentially authorize access.
- hash functionuses · A hash function is a deterministic function that maps input data to a hash value, typically of fixed size, for uses such as lookup, indexing, comparison, or integrity checking.
- symmetric encryptionkind of · Symmetric encryption is a cryptographic technique in which the same shared secret key, or equivalent shared secret material, is used to encrypt and decrypt data.
- block cipheruses · A block cipher is a keyed symmetric cryptographic algorithm that transforms fixed-size blocks of data into ciphertext.
- cryptographic hashuses · A cryptographic hash is a fixed-length digest computed deterministically from input data by a function designed to resist practical preimage, second-preimage, and collision attacks.
Questions about message authentication code
What is message authentication code?
A message authentication code is a keyed cryptographic value generated from a message to verify its integrity and authenticity.
Which Manning books explain message authentication code?
Hacking Cryptography, Software Security for Developers, Real-World Cryptography and Secure APIs.
What should I know before learning message authentication code?
Manning books that teach message authentication code usually introduce digital signature, hash function, SHA-2 and AES first.
What kinds of message authentication code are there?
Kinds of message authentication code include HMAC.
What is message authentication code a kind of?
Message authentication code is a kind of symmetric encryption. Symmetric encryption is a cryptographic technique in which the same shared secret key, or equivalent shared secret material, is used to encrypt and decrypt data.
What is message authentication code also called?
Message authentication code is also called authentication tag or Mac.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



