Content-Digest
Verifying message content was not corrupted or tampered with during transmission requires an integrity digest. The Content-Digest request or response header provides this digest for the actual message content transmitted over the wire.
Usage
The Content-Digest header enables verification of message content integrity by computing a digest over the literal bytes transmitted in the HTTP message. This digest reflects the content after applying transformations like Content-Encoding, matching exactly what travels across the network.
Servers send Content-Digest to allow recipients to verify the message content was not corrupted or modified during transmission. The header uses the Structured Fields Dictionary format, pairing algorithm identifiers with Base64-encoded digest values. Multiple algorithms appear in a single header when content negotiation or algorithm agility is needed.
The header differs from Repr-Digest, which computes digests over the entire selected representation, including any content coding applied to it. Content-Digest covers the transmitted message content, which may be partial for range responses or empty for HEAD responses, making the header suitable for detecting transmission errors and verifying message-level integrity.
Clients request specific digest algorithms using Want-Content-Digest. Servers respond with preferred algorithms when no explicit request is made. Both headers work in requests and responses, and both support trailer fields when computing digests incrementally.
Algorithms
sha-256
The sha-256 algorithm produces a 256-bit digest using the SHA-256
cryptographic hash function. This algorithm suits most integrity
verification needs and is widely supported.
sha-512
The sha-512 algorithm produces a 512-bit digest using the SHA-512
cryptographic hash function. This algorithm provides stronger
cryptographic properties for contexts requiring additional security
margin.
md5
The md5 algorithm is registered for
Content-Digest with Deprecated status, alongside
sha, unixsum, unixcksum, adler, and crc32c.
Only sha-256 and sha-512 carry Active status.
MD5 is vulnerable to collision attacks and suits only
detection of non-adversarial corruption, so integrity
verification belongs on the Active algorithms.
Example
A server sends a SHA-256 digest of the transmitted message content. The Base64-encoded value represents the digest computed over the literal bytes sent after applying any content encoding.
Content-Digest: sha-256=:RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:
Multiple algorithms appear when the server supports algorithm negotiation. The recipient selects the strongest recognized algorithm and verifies the content against the corresponding digest value.
Content-Digest: sha-256=:RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:, sha-512=:YMAam51Jz/jOATT6/zvHrLVgOYTGFy1d6GJiOHTohq4yP+pgk4vf2aCsyRZOtw8MjkM7iw7yZ/WkppmM44T3qg==:
See also
- RFC 9530: Digest Fields
- Repr-Digest
- Unencoded-Digest
- Want-Content-Digest
- Digest
- Content-Encoding
- Structured Fields
- HTTP headers