Digest

The Digest response HTTP header provides a digest of the selected representation of the requested resource.

Representations are different forms of a particular resource that might be returned from a request: for example, the same resource might be formatted in a particular media type such as XML or JSON, localized to a particular written language or geographical region, and/or compressed or otherwise encoded for transmission. The selected representation is the actual format of a resource that is returned following content negotiation, and can be determined from the response's Representation headers.

The digest applies to the whole representation of a resource, not to a particular message. It can be used to verify that the representation data has not been modified during transmission.

Note: While a representation may be fully contained in the message body of a single response, it can also be sent using multiple messages in response to a range request, or omitted altogether in response to a HEAD request.

Header type Response header
Forbidden header name no

Syntax

Digest: <digest-algorithm>=<digest-value>
Digest: <digest-algorithm>=<digest-value>,<digest-algorithm>=<digest-value>

Directives

<digest-algorithm>

Digest algorithms are defined in Digest Headers.

  • Permitted digest algorithms values include: unixsum, unixcksum, crc32c, sha-256 and sha-512, id-sha-256, id-sha-512
  • Deprecated algorithms values include: md5, sha, adler32.
<digest-value>

The result of applying the digest algorithm to the resource representation and encoding the result. The choice of digest algorithm also determines the encoding to use: for example SHA-256 uses base64 encoding.

Examples

Digest: sha-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=
Digest: sha-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=,unixsum=30637

Specifications

Specification
Digest Fields
# section-3

Browser compatibility

BCD tables only load in the browser

See also