Message digest is a hash code of a byte sequence (message).It has certain properties that make it very unique and very useful:
- It has a fixed size (in bytes), which does not depend on the size of the original byte sequence.
- It is always the same for the same byte sequence.
- It will change significantly for even slightest changes in the original byte sequence.
- It is not practically possible to find another byte sequence with the same message digest. Which means, that message digest quite uniquely identifies the original byte sequence. That’s why it is sometimes called “a data fingerprint”.
- It is impossible to derive the original byte sequence from the message digest.
What can it be used for?
For instance, you could use it if you wanted to verify that the contents of some file hadn’t changed. It is much more time consuming that checking last modified date, but much more reliable.
It can also be used in database tables where the username and password are insecurely stored in plain text. Store the message digest of the password instead of the password text. This way nobody but the user him/herself knows the password, but you still can verify the password for validity.