Hash function is a process of taking any input (long or short message) and return a fixed-size alphanumeric string. The output string is known as the “hash value”, “message digest”, “digital fingerprint” or sometime is called as “checksum”. The figure below shows how the Hash functions work.
The figure above shows the following:
- Message (x) is the long message, which is divided into number n of blocks.
- (z) is typically much smaller than (x), which is the result of hashing the original message h(x). Note: h(x) is public.
- The result of (z), will be signed with the private-key
- (s) will be sent to the other party, where it can be verified via the sender’s public-key.
There are many advantages can be found in the Hash functions such as:
- Arbitrary size of input message (x), gives a fixed-size output.
- Difficult to know the original message (x) after hashing it.
- The hash computation should be fast.
Note: any small change in the input in the hash function will make a big change in the output. The following figure shows the fixed-size result of hashing any message.