### Recap

In Part One, we understood what a cryptographic hash function is and how it works. If you missed that post, we suggest please go back and go through it before going any further. Today, we will understand the Five Requirements of a good Cryptographic Hash Function. Before we start, we suggest you watch this one minute summary video of today’s post.

A good cryptographic hash function must possess the following five properties:

### One Way

A cryptographic hash function must always be one way. That is, it should be possible to find the hash from an input easily. But, the reverse must not be possible. That is, by no means should the input be recovered from the hash. This one way functionality of hashes is the reason why passwords are usually hashed before they are stored in the database. So even if someone manages to get access to the database, they still won’t be able to reverse the hash.

### Deterministic

A cryptographic hash function must be deterministic. For a given input value, the output must always give the same hash value if passed through the same cryptographic hash function. In addition, two copies of the same document should also always give the same hash when passed through the same cryptographic function.

### Fast Computation

The cryptographic hash functions undergo a number of computations before they produce the hash. These computations make the hash one way, so they are important and can’t be ignored. However, computers must also be able to perform the mathematical calculations involved in producing the hash from the input in a short period of time. This property is also known as the hash functions being computationally efficient.

### Must Withstand Collisions

A collision is a situation when the hash function gives the same output value for two different inputs. The perfect analogy for this is having two human beings with same fingerprints. The probability of two human beings having the same fingerprint is one in 64 million. Similarly, no two unique inputs should produce the same hash as output. This property of a hash function withstanding collisions is very important for blockchain based applications.

### Avalanche Effect

The hashes generated from an input must not have any visible pattern of hash generation. This is because no user should be able to find a hidden way of guessing the hash; else they will be able to break the hash function easily. And so, for every single bit change in the input, the output hash should change completely. This is called the **Avalanche Effect**.

“hello” and “Hello” will produce completely different hashes even if just the ‘h’ is capitalized and the remaining input stays the same. This is because of the Avalanche effect

Read More at www.theblockchainblogger.com