HOW HASHING ALGORITHMS WORK?

A hashing algorithm is defined as a one-way algorithm that produces a fixed-length output irrespective of size of input string. Hashing algorithms are used for integrity assurance.



There few properties of Hash Algorithms:

1. You cannot reproduce the original data/string from a provided hash output. It means that reverse process is not feasible. This is very helpful as a hacker cannot derive the original string by just knowing the hash output.

2. Hash outputs of two different strings will always be different. There is also called hash collision resistance. Even if the hacker manages to find the input string and corresponding hash output, if he tries substitute the input string with his malware, the hash output for the manipulated will be considerably different.

3. Any small change done to the clear-text input results in a large change to the hash output. In below image there is a small change of first character in the string and corresponding hash output for each string is considerably different.


 Two common hashing algorithms are MD5, which gives you a fixed-length 128-bit output, and SHA-1, which gives you a fixed-length 160-bit output.