Cryptographic Hash

A cryptographic hash is a mathematical algorithm that maps data of an arbitrary size to a digest of a fixed size. For example, one of the most popular hashing algorithms is the SHA-256 hashing algorithm. SHA stands for Secure Hash Algorithm. A SHA-256 hash is ALWAYS 256 bits longs, hence it is of a fixed size.

Here is a short phrase that is 10 words long:

My little dog Alfie is a very shy dog indeed.

How can we represent this phrase in 256 bits (256 bits corresponds to 64 hexidecimal characters)? By running the phrase through the SHA-256 hashing algorithm.

My little dog Alfie is a very shy dog indeed.

run through the SHA-256 hashing algoritm results in this SHA-256 hash:


Now, let us change just one character in the phrase. We'll change the ending period to an exclamation mark:

My little dog Alfie is a very shy dog indeed!

The SHA-256 has will COMPLETELY change:


So a cryptographic hash is an excellent way to see if data has changed, or has become corrupted.

This article was updated on November 29, 2021