Hash Function: A Simple Explanation Of The Basics
To fully explain what a Hash Function is, we will be breaking it down into a familiar scenario. Take a moment to imagine the environment of the birthing of a new baby. Here, the man deposits his seed into the woman and harvests a child after nine months.
Thank you for reading this post, don't forget to subscribe!
That’s the basic principle of the hash function. Simple right? Hashing according to Espresso is the process of converting a given key into another value. Hashing refers to the procedure of producing a fixed output for an existing input.
As long as the input doesn’t change, you can run it multiple times with the same result. But a slight change gives an entirely different output altogether. For example, the input “Queen” will give a different output from the input “queen”
Hashing or Hash function is the heart of cryptography as it aid with the vigour of integrity, trustworthiness and security of the Blockchain system. It is formidable because the input cannot be revealed by running its output.
Consequently, before a hash function can be considered secure, the following three properties must be considered. It must be collision resistance, pre-image resistance and second pre-image resistance. They can in be explained summary as follows;
- Collision resistance
Impossible to discover two different inputs that produce the same output.
- Preimage resistance
Impossible to reverse the hash function (discover the input from a given output)
- Second pre-image resistance
Impossible to find any other input that clashes with a specified input.
To further aid the understanding of the above properties
Collision resistance, as explained, a collision occurs when two different inputs produce the same output (hash). Therefore, a hash function is regarded as collision resistance as long as a collision is not found.
A collision though cannot be avoided forever. Well, because the inputs are unlimited, while the outputs are limited. Based on the above statement, you could say that no hash function is collision resistance.
But a hash function is collision resistance when the possibility of finding a collision is so low that it takes years of computation to get that collision. The pre-image resistance concept is an important one, as it prevents one’s personal information from being revealed.
A hash function is considered pre-image resistance as long as no one finds an input from the output. Second pre-image resistance is attached to collision resistance. It means it is unlikely to discover any second input that has the same output as a given input.