Digest or Hash


[This sample code uses features that were implemented in MSXML 5.0 for Microsoft Office Applications. XML digital signatures are not supported in MXSML 6.0 and later.]

The digest of data is the result of some fixed bit length of a one-way hash function that takes the data as input. A digest is sensitive to changes in the corresponding data. Therefore, it serves as a unique and in most cases compacted representation of the original data.

The strength of a hash algorithm is measured by the unlikelihood of collision. A collision is when two pieces of data produce the same digest. The strength increases with the bit length of the hash value. Digests are useful because computations involved in encrypting or decrypting a digest are usually much less demanding than encrypting or decrypting the data itself.

Commonly used hash functions include Secure Hash Algorithm 1 (SHA-1) whose output is of 160 bit in length.

In MSXML, the supported methods for digest include SHA-1.