What is a hash function?

General information

A cryptographic hash function is a mathematical algorithm that maps arbitrary size data into a fixed-size bit array.

The result produced by a hash function is called a “hash sum” or simply a “hash”, and the input is often called a “message”.

The following conditions are met for an ideal hash function:

a) the hash function is deterministic, ie the same message leads to the same hash value
b) the value of the hash function is quickly calculated for any message
c) it is not possible to find a message that gives the specified hash value
d) it is not possible to find two different messages with the same hash value
e) a small change in the message changes the hash so much that the new and old values ​​seem uncorrelated

Let’s take a look at an example of how the SHA3-256 hash function works.

The number 256 in the name of the algorithm means that at the output we get a string of fixed length 256 bits, regardless of what data is input.

The figure below shows that at the output of the function we have 64 digits of the hexadecimal number system. Translating this into a binary system, we get the desired 256 bits.