Digest

The HTTP Digest response header contains a hash-generated digest of the current representation of the resource.

Usage

The HTTP Digest header contains the message digest for the current representation. It is important to recognize that it is the digest for the entire representation of the resource and not generated for an individual message. The client can recalculate the digest using the resource received and compare it to the digit value to detect whether there have been errors during transmission.

The two directives are the digest-algorithm and digest-value. The available digest algorithms are defined in Digest Fields and include unixsum, unixcksum, crc32c, sha-256, sha-512, id-sha-256, and id-sha-512. There are several deprecated algorithms including md5, sha, and adler32.

A client can request that a message digest be sent by including the HTTP Want-Digest request header.

Example

In this example, the sha-512 hashing algorithm is used by the server to create the digest value, which is sent to the client. Once it arrives, the client can run the same hashing algorithm and compare the values.

Digest: sha-512= 3b761a2a9a96e1c430236dc31378a3450ea189ae1449c3c8eac25cfa8b25381661317968a54cf46bfced09ae6b49f8512832182ac2d087b22380fcb760d802a3

Takeaway

The HTTP Digest header contains the hash value for the current representation of the current resource using a specific hashing algorithm, which can be re-calculated and compared to check for transmission errors.

See also

Last updated: June 2, 2022