If cryptography were a car, then the hashing algorithm is its engine. This complex algorithm for the majority of the people is unknown and for the others, it’s just something they have heard about but don’t really know what’s about. Before we get started with the explanation we have to answer a few questions like, What is Hashing? How does it work? Why is it there? etc.

## What is Hashing?

Let’s suppose that you want to send a message or a file to someone and is imperative that it reaches the destination in time and without getting tampered with. What if your message needs to be sent and received in the same type, what if the message goes over some gigabytes? It would be impractical and not usable for anything, well here comes hashing to play. Using a chosen hash algorithm, data is compressed to a fixed size. Let’s understand this with an example. If we take the sentence, “Hodler 2020” and apply **the SHA256 **hash algorithm to it, we will get **3C48FCE221606AD22DCF11C56A29A3C11DAEADA4A0BE208B9391ACAF26662194**.

This value is known as a **hash**. From this example, you would think it just added more characters and made it harder to work with. And you may be right since hashing isn’t used for small sentences. Hashes are mostly used to compare or identify databases that have large values in them, storing passwords, SSL certificates, and much more. Rather than comparing the data in its original form we can simply compare the hash values and tell the differences or identify. This way we are super-efficient with our time and that’s a huge reason hash algorithms are widely used in IT.

Hashing has two fundamental distinct characteristics.**Irreversibility**, once you hash something you can’t take it back. Unlike encryption and decryption, you can’t easily de-hash it.

Unique, because there are never the same hash values for two different pieces of data. If two hashes are found to be the same for two different pieces of data, it’s called a ‘hash collision’ and that algorithm becomes useless.

## The Hashing Function

The hashing function is the core that makes hashing available. A hash function is a mathematical function that converts an input value into a compressed numerical value – a hash or hash value. Basically, it’s a processing unit that takes in data of arbitrary length and gives you the output of a fixed length – the hash value. The length of the output of the hash depends on the hashing algorithm. Generally speaking, the most popular hashing algorithms or functions have a hash length ranging from 160 to 512 bits.

Some of the most popular Hashing Algorithm’s are:

## How does the Hashing Algorithm work?

As we learned by now the heart of the Algorithm is the Hashing Function and for this function to work it needs a set amount of data at a fixed length. The parameters are different for each algorithm type but the concept is the same. These are called “Data Blocks”.

Let’s take, for example, SHA-256 accepts data blocks that are 32 bytes in size. So if the message is exactly 32 bytes the hashing function runs only once. However, almost 99 percent of the time, the message won’t be in the multiples of 32 bytes. For such cases, a technique called **padding** is used. Using a padding technique, the entire message is divided into fixed-size data blocks. The hash function is repeated as many times as the number of data blocks.

## No Comments