Message and message digest
- The electronic equivalent of the document and fingerprint pair is the message and message digest pair.
- To preserve the integrity of a message, the message is passed through an algorithm called a cryptographic hash function.
- The function creates a compressed image of the message that can be used like a fingerprint.
- To check the integrity of a message or document, we run the cryptographic hash function again and compare the new message digest with the previous one. If both are the same, we are sure that the original message has not been changed. Figure shows the idea.

Properties of cryptographic hash function
- Preimage resistance :
- For a given value h, it is computationally infeasible to find x
such that H(x)=h
- i.e It is difficult for an attacker to compute the preimage of the hashed value.
Also referred to as a one way property.
- Second pre-image resistance.
- The attacker, if given value of x, it is computationally infeasble to find y, y ≠x such that H(y) = H(x).
- Also called weak collision resistance.
- It means that an alternate message hashing to the same value cannot be found.
- Collision resistance.
- It is computationally infeasible to find any pair ( x,y) such that H(x) = H(y).
- Also referred to a strong collision.
MD5
- Developed by Ron Rivest of MIT.
- Was the mostly used secure hash algorithm till it was cracked.