The term hash function originates historically from computer science, where it denotes a function that compresses a string of arbitrary input to a string of fixed length. 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. Cryptographic hash functions can be used to provide message integrity, to protect information authenticity, to protect against the threat of repudiation and to secure passwords. Unlike secret key and public key algorithms, hash functions, also called message digests, have no key.
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.