Blockhain Hashing Algorithms Explained – All You Need to Know

Beginner’s Guide / 21.05.2020

A Hash is a central concept in all modern communication, storage, and security. Some might even call Hashing the backbone of the internet. But when we say hash, what do we mean? Is it simply something to do with random numbers? Are numbers that important?

This introduction may seem difficult to understand, yet the concept is not difficult at all. Of course, we are not going to enter into the details of the functioning of the algorithm, but we will describe it in essence and see what a hash is capable of.

What is a Hashing?

Hashing is an algorithm that calculates a fixed-size bit string value from a file. A file basically contains blocks of data. Hashing transforms this data into a far shorter fixed-length value or key which represents the original string. The hash value can be considered the distilled summary of everything within that file.

For better perception, look at the illustration below. How using a simple hash function called the SHA-256 makes the result unique and falsifiable. A change in a single character leads to a completely unrelated result, which is probabilistically guaranteed to be unique to that input.

how hashing function works

A hash algorithm determines the way in which the hash function is going to be used. It is therefore important to differentiate between the algorithm and the function. A good hash algorithm should be complex enough so that it does not produce the same hash value from two different inputs. If it does, this is known as a hash collision. A hash algorithm can only be considered good and acceptable if it can offer an incredibly low chance of collision.

Hashes come in different varieties, from a simple computationally easy function to functions that use astronomical amounts of computation power. One of the most famous hashing algorithms is the Message Digest (MD) series, of which MD5 is the most widely used.

The MD5 hash function encodes a string of information and encodes it into a 128-bit fingerprint. MD5 is often used as a checksum to verify data integrity. However, due to its age, MD5 is also known to suffer from extensive hash collision vulnerabilities, but it’s still one of the most widely used algorithms in the world.

Hashing is used to validate the integrity of the content by detecting all modifications and thereafter changes to a hash output. Encryption encodes data for the primary purpose of maintaining data confidentiality and security. You can see the use of a Hash in almost any area which requires

  • Confidentiality
  • Proof and Refutation
  • Time Stamping
  • Falsifiable Continuity

Top 3 Hashing Algorithms in Blockchain

  • Secure Hashing Algorithm (SHA) 256

SHA-2, developed by the National Security Agency (NSA), is a cryptographic hash function. SHA-2 includes significant changes from its predecessor, SHA-1. The SHA-2 family consists of six hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256.

  • X11

This algorithm which has been designed for cryptocurrencies, is still more secure than the algorithm SHA-256 and presents the advantage of not being able to be used by “Application Specific Integrated Circuits”. It is currently being used in several crypto-currencies, the most famous being Dash.

X11 organizes a chain of 11 different hash algorithms: Blake, BMW, groestl, JH, keccak, skein, Luffa, cubehash, shavite, SIMD, and echo. To fail, all of the 11 hashing algorithms must default simultaneously. It is estimated that the probability of such a situation is close to zero. This is the reason why ASICs cannot be used to perform the Algorithm X11 since it included 11 different algorithms.

  • ETH Hash

Ethash is the proof-of-work function in Ethereum-based blockchain currencies. It is a hash function belonging to the Keccak family, the same family which the SHA-3 hash functions belong to. However, Ethash is not a SHA-3 function, and should not be confused with them.

Bitcoin and SHA-256

SHA-256 (“Secured Hash Algorithm 256″) is the algorithm which was chosen by the designer(s) Satoshi Nakamoto. It is used during the creation of the public key from the private key, but also for the realization of the process of proof of work. This algorithm has been developed by the NSA (” United States National Security Agency”) in 2001 and continues to be used by many financial institutions and governments for the encryption of their data.

blockchain simplified

The success of the Bitcoin, however, poses an important problem concerning the use of the algorithm SHA-256. As we have already seen, each new bitcoin created returns to the miner who has carried out and submitted first to the network the “Proof of work”. However, the likelihood for a minor to provide the “Proof of work” in the first position is directly proportional to the capacity of calculation that it can deploy on the network, i.e. the hashing power.

In the above example, the hash algorithm is SHA256, which is the one used by the Protocol Bitcoin. The object to which it applies the function (“input”) is a numeric value whose size can vary according to the algorithm. Here the input are pieces of sentences, but it is possible to imagine any type of data (Figures, letters, signs…) having a different size.

The size corresponds to the number of characters which composed the group of data. The three inputs are therefore submitted together to the hash algorithm and the numerical value that results in “output” is always of fixed size (between 160 and 512 bits according to the type of function). In the case of SHA256, the size of the output is always 256bits, or 256 characters…logic.

avatar
Sudarshan M is a long time crypto-enthusiast. Pulled in by bitcoin early on, it did not take long for Sudarshan to divert all of his academic attention from business studies to blockchain by doing his Masters and eventually pursuing his PhD in the subject.