liveBook · Manning

HMAC

HMAC is a keyed message authentication code constructed from a cryptographic hash function and a secret key to authenticate data and verify its integrity.

How 4 Manning books explain it

Software Security for Developers

HMAC is a keyed message authentication construction that combines a secret key with a cryptographic hash function to provide message integrity and authenticity.

How it is used
Protects files, request payloads, API calls, and protocol messages against tampering while authenticating parties sharing a secret.
How deep it goes
Defines the construction and implementation choices, but deliberately defers the internal key-mixing algorithm and its mathematics.
Examples
Uses an ACME refunds.json transfer, Java Mac code, validation logic, and comparisons with plain hashes and RSA signatures.
What you can do after
Apply it via Java's Mac and SecretKeySpec APIs to compute and validate HMAC-SHA-256 values before processing data.

Read how Software Security for Developers explains HMAC →

Hacking Cryptography

HMAC is a keyed-hash message authentication construction that produces an integrity and authentication tag from a key and message.

How it is used
Authenticates messages and detects modification when a shared secret must protect an API request or protocol message.
How deep it goes
Explains the nested equation, key normalization, ipad/opad transformations, and attacks against simpler MACs.
Examples
Uses a forged bank transaction, Flickr-style API authentication, RADIUS, AWS API signatures, and HMAC-MD5 as concrete cases.
What you can do after
Evaluate MAC designs and choose HMAC instead of direct secret-prefix or secret-suffix hashing for authentication.

Read how Hacking Cryptography explains HMAC →

Secure APIs

HMAC is a message authentication code construction that combines a hash function with a secret key to authenticate data.

How it is used
Authenticates API requests and JWTs by combining a shared secret with a hash-derived digest or signature.
How deep it goes
Defines shared-key request authentication and JWT signing inputs, but does not descend into HMAC internals or implementation code.
Examples
Uses an HS256 JWT whose signature covers the base64url-encoded header and payload joined by a dot.
What you can do after
Evaluate/understand how HMAC authenticates API requests and signs JWTs without encrypting their claims.

Read how Secure APIs explains HMAC →

Real-World Cryptography

HMAC is a standardized keyed-hash message authentication code constructed from a cryptographic hash function and a secret key.

How it is used
Protects message integrity and authenticity when communicating parties share a secret key.
How deep it goes
Explains keyed tag generation, verification, replay limits, length-extension risks, and constant-time comparison without detailing HMAC internals.
Examples
Demonstrates Rust sender and receiver functions using HMAC-SHA-256, message tags, and verification.
What you can do after
Apply it via Rust to authenticate messages, verify tags safely, and avoid direct SHA-256 MAC constructions.

Read how Real-World Cryptography explains HMAC →

Related concepts

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.