A hash function is a transformation that takes a variable-size input data m and returns a fixed-size string, which is called the hash value h (that is, h = H(m)). Any change to the input data will (with very high probability) change the hash value. Hash functions with just this property have a variety of general computational uses, but when employed in cryptography the hash functions are usually chosen to have some additional properties.
The basic requirements for a cryptographic hash function are:
The hash value represents concisely the longer message or document from which it was computed. One can think of a message digest as a "digital fingerprint" of the larger document.
The main role of a cryptographic hash function is in the provision of digital signatures. Additionally, a digest can be made public without revealing the contents of the document from which it is derived.