Theoretically, MD5 and SHA1 are algorithms for computing a ‘condensed representation’ of a message or a data file. The ‘condensed representation’ is of fixed length and is known as a ‘message digest’ or ‘fingerprint’.
What makes this exercise useful, is that it is conjectured that it is computationally infeasible to produce two messages having the same message digest. This uniqueness enables the message digest to act as a ‘fingerprint’ of the message… opening up the possibility of using this technology for issue like data integrity and comparison checking.
For instance when you download or receive a file, you can use MD5 or SHA-1 to guarantee that you have the correct, unaltered file by comparing its hash with the original. You are essentially verifying the file’s integrity.
It needn’t be a file of course – any message or similar construct for which you need to ensure integrity can be verified in this way. All sorts of possibilities emerge…