SHA256 Hash

All sources are from [Blockchain A-Z in Udemy]

Understanding SHA256 Hash

The SHA256 hash is like a fingerprint. The SHA256 hash was developed by the National Security Agency (NSA).

It is used in many applications around the world, and it is also used in blockchain.

Let's understand the operating principles and concepts of SHA.

SHA256

SHA256 stands for Safe Hash Algorithm, and 256 is the number of bits that occupy the memory.

The hash is always 64 characters long and can come with numbers or characters, but because it is a hexadecimal hash, it comes with 16 characters of [0-9] + [A-F].

64 characters take up 256 bits, so each character takes up 4 bits. It can be said that this algorithm is very good in that it can be applied to any digital document as well as Text document.

The hashing algorithm has five requirements. Of course, there is not only SHA256 in the algorithm, but there are SHA512, SHA3, and so on.

We can also create hashing algorithms, but we need to meet some requirements to make them useful.

  1. One-Way

    Just like a human fingerprint, having a fingerprint cannot restore a person. Also, you can't tell a person's information (name or personality) by fingerprints.

  2. Deterministic

    Applying the same document to the hashing algorithm requires obtaining the same hash value.

  3. Fast Computation

  4. The Avalanche Effect

    The avalanche effect means that the hash value is completely different if there is even a very small variation (a change of 1 bit) in the same document. The reason why it is called the avalanche effect is the way the algorithm is implemented, which I think would be better to look up the paper.

  5. Must withstand collisions

The hash was likened to a fingerprint, and with a probability of one in 60 million, you may meet someone with the same fingerprint. The same goes for hash. The hashing algorithm uses 64 bits, which can produce many combinations, but is still not infinite. That's why having the same hash is theoretically unlikely, but it can happen. However, this is a rare occurrence, so it can be sufficiently solved. Collision resistance means that the algorithm must be able to withstand artificial collisions. If an attacker deliberately makes the hash of two different documents identical, the document can be forged. Whether such collision can be resisted can be said to be collision resistance.

Last updated