What is hash function and what security objective does it mainly serve?
A hash function is cryptographic technique that takes an arbitrarily sized message as its input and produces a fixed-sized output message known as hash value or message digest (MD). It is one-way function which means it is infeasible to drive or compute the actual message from the hash value. Additionally, the hash algorithm generates the message digest using block cipher and produces fixed-sized blocks of 64, 128, 160, 256, 512 and so on.
There are different hashing algorithms and some of the most common ones include MD2 /MD4 / MD5 / MD6 and SHA-1, SHA-2 (SHA-224, SHA-256, SHA-384, SHA-512), SHA-3. However, there are secure and insecure hash functions that we must pay attention to before adopting them to secure our data. MD6, SHA-2 and SHA-3 are secure algorithms that are still in use in the industry. Whereas the rest of the algorithms mentioned earlier are deprecated and insecure ones.
The hash function mainly ensures the integrity of the message.