Hashing In Blockchain

Blockchain technology is one of the most revolutionary technological innovations of our time. It has introduced De-fi, DApps, and Non-fungible tokens(NFTs). But to understand how blockchain works in cryptocurrency, we need to understand one basic concept: Hashing. In this article, we will discuss cryptography, hashing in blockchain, and its characteristics.


Before we discuss hashing, let us discuss the term Cryptography. We come across this term often when we talk about blockchain technology.

Cryptography is a technique for securing communication by transforming plain text into a coded message using mathematical algorithms known as ciphers to protect sensitive information from unauthorized access or tampering.

Cryptography involves two processes: Encryption and Decryption. Encryption is the method of transforming plain text into a coded message using mathematical algorithms, and Decryption is the method of converting cipher text into plain text by a secret key or algorithm.

What’s hashing in Blockchain?

Let’s take our definition further. Imagine we want to send a message to someone, and for that, we use an encryption algorithm to encrypt it, but it gives an output of a fixed length irrespective of the input length. If we make even a tiny change in our input, it completely changes the cipher text. The below diagram makes it more clear what we mean.

Thus, Hashing is a cryptographic function that converts a large amount of data into a fixed-size string of characters, known as a hash or hash value.

A perfect example of hashing in the blockchain is its use in cryptocurrencies.

Hashing algorithm takes transactions of varying lengths and gives an output of fixed length irrespective of the input transaction length. An example of the hashing algorithm is Secure Hash Algorithm-256 (SHA-256) which always gives the output result of 256 bits length regardless of the input length.

Cryptographic Hash functions

Cryptographic hash functions are mathematical algorithms that take any transaction/data input and map them to a fixed-size output, called a hash or digest. The fundamental characteristic of any hash function lies in the size of its output result.

Different cryptocurrencies use different cryptographic hash functions, but they all follow the basic principle of hashing. Some of the different hashing algorithms are as follows:

Characteristics of Cryptographic hash functions

The hash functions have to portray some characteristics or properties that make them suitable and secure for cryptocurrencies like Bitcoin or Ethereum. Let us discuss each of these properties of hash functions.

  • Deterministic Hash functions will generate the same output for the same input. For example, if we use the SHA-256 algorithm to create a hash for siam, it will always give the same result. However, if we change even a single letter, it will generate a completely different hash.
  • One-way function
    If someone gives you a new output, it is infeasible to determine the input, and it is virtually impossible to reverse the hash function. The only method is to try out random strings until you find out the right one to determine the input.

SHA-256 hash function used by bitcoin generates hashes that are 256 bits long (a 256-digit-long string of 1s and 0s). It means SHA-256 generates 2²⁵⁶ unique hashes. 2²⁵⁶ is an enormous number. Think about it this way: 2²⁵⁶ is roughly equal to the number of atoms in the entire observable universe. The sheer size of this number means that the chances of collision are minute.

I hope this article makes you familiar with hashing, cryptographic hash functions, and its characteristics. The cryptographic hash functions serve as the basis for building a blockchain and are an integral part of blockchain innovation.

Written by,

Shauryaditya Yadav of SIAM Student's Chapter VIT Bhopal



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store