The Digest
response HTTP header provides a digest of the requested resource.
In RFC 7231 terms this is the selected representation of a resource. The selected representation depends on the Content-Type
and Content-Encoding
header values: so a single resource may have multiple different digest values.
The digest is calculated over the entire representation. The representation itself may be:
- fully contained in the response message body
- not at all contained in the message body (for example, in a response to a
HEAD
request) - partially contained in the message body (for example, in a response to a range 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>
- Supported digest algorithms are defined in RFC 3230 and RFC 5843, and include
SHA-256
andSHA-512
. Some of the supported algorithms, includingunixsum
andMD5
are subject to collisions and are thus not suitable for applications in which collision-resistance is important. <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 | Title |
---|---|
Resource Digests for HTTP |
This header was originally defined in RFC 3230, but the definition of "selected representation" in RFC 7231 made the original definition inconsistent with current HTTP specifications. When released, The "Resource Digests for HTTP" draft therefore will obsolete RFC 3230 and will update the standard to be consistent.
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Digest | Chrome Full support Yes | Edge Full support 12 | Firefox Full support Yes | IE Full support Yes | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support Yes | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support