5Hash functions

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 input can be of any length,
- the output has a fixed length,
- it is easy to compute the hash value for any given message,
- hash functions are one-way, that is to say, it is computationally infeasible to generate a message that has a given hash,
- it is infeasible to modify a message without changing the hash,
- Collision resistant, that is to say, it is computationally infeasible to find two distinct messages that hash to the same result.

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.

Fig 5.1 Hash function