What is hashing algorithm? How it works?

Technology CommunityCategory: Hash TablesWhat is hashing algorithm? How it works?
VietMX Staff asked 3 years ago

A hash function lies at the heart of a hashing algorithm. 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. But, to get the hash value of a pre-set length, you first need to divide the input data into fixed sized blocks. This is because a hash function takes in data at a fixed-length. These blocks are called ‘data blocks.’

The size of the data block(s) differs from one algorithm to another. But for a particular algorithm, it remains the same. For example, SHA-1 takes in the message/data in blocks of 512-bit only.

99% of the time, the message won’t be in the multiples of 512-bit. For such cases (almost all 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. This is how it’s done:

 

ash-algorithm