HTTP headers | Want-Digest

Before discussing about HTTP Want-Digest Header, let us first understand what is Digest (or message digest) ? HTTP header Digest is an encrypted fixed-size representation of a message generated using a hash function. A hash function can be any function that maps the data of arbitrary size to a fixed size. Message digests are easy to encrypt but very hard to decrypt. It can be said that the process is irreversible. Therefore, message digests protect the integrity of the message and can easily detect any modifications in the message. Various types of hashing algorithms are used for the encryption of these messages.

HTTP Want-Digest header: The HTTP Want-Digest Header is a general HTTP header that requests the server to provide a digest of the requested source using the HTTP Digest response header. The requester sends one or more digest algorithms that can be used to create the digest within the header. If the server does not support these algorithms either the digest is calculated using some different algorithms or a 400 Bad Request is received with a list of supported algorithms in another HTTP Want-Digest Header.

Syntax:



  • For single algorithm:
    Want-Digest: <algorithm>
  • For more than one algorithm plus quality value syntax:
    Want-Digest: <algorithm><q-value>, <algorithm><q-value>

Note: This header can contain multiple digest algorithm.

Directives: The HTTP Want-Digest header accepts two directives mentioned above and described below:

  • <algorithm>: This directive holds the algorithm that supports digest algorithms include SHA-256, MD5 and SHA-512.
  • <q-value>: This directive holds the quality factor associated with the algorithms to indicate the preference of the algorithms. It ranges from 0 to 1, where 1 denotes the highest priority.

Example:

  • This example holding the single digest algorithm without the quality value of that algorithm.
    Want-Digest: sha-512
  • This example holding more than one digest algorithm with the quality value of that algorithm.
    Want-Digest: sha-512;q=0.55, sha-256;q=0, md5;q=1

Supported Browsers: The browsers are compatible with the HTTP Want-Digest header are listed below:

  • Google Chrome
  • Firefox
  • Internet Explorer
  • Edge
  • Opera
  • Safari


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.