Hashing
While encryption is about confidentiality, hashing is about integrity and authentication. Hashing algorithms reduce any amount of data to a fixed length value known as the hash value. This hash value is a sort of fingerprint of the initial data. Due to the algorithms used to create hash values, even small changes in the initial data will create huge changes in the hash value. This makes it harder to guess the initial data with a trial-and-error approach.
Since you can have initial data of the desired length, and the output will be of fixed length, there is the possibility that different initial data will have the same hash value. This is called collision.
For example, let's see the difference between Password
and password
:
$ echo "password" | shasum -a 1 c8fed00eb2e87f1cee8e90ebbe870c190ac3848c - $ echo "Password" | shasum -a 1 3f44a88d098cdb8a384922e88a30dbe67f7178fd -
From a security standpoint, the biggest risk of hashing algorithms is the collisions. A well-designed algorithm...