What is Hashing in Blockchain? The Basics Covered

11/23/2023, 3:51:21 AM
Beginner
Blockchain
This article explores the fundamental role of hashing in blockchain technology, a key innovation central to maintain the security and reliability of cryptocurrencies. Readers will gain insights into the accessible yet profound world of hashing, an essential cryptographic tool that has fortified blockchains, making them secure platforms for financial transactions.

There are a variety of innovations that contributed to blockchain technology, one of the most important is hashing. But what is hashing in blockchain? Without it blockchains would be insecure, and altogether unusable. With it, they make cryptocurrency secure and reliable.

If you don’t want to get a computer science degree and would like to know the ins and outs of this cryptographic primitive, then stick around. You will find that the understanding hashing isn’t so hard.

What is cryptography?

The word cryptography comes from the Greek word kryptos, which means hidden. It is the study and application of methods for safe communication in the face of hostile activity. In essence, it is the act of encoding messages. Modern cryptography is computer centric but dates back to ancient times.

The Egyptian hieroglyphics are a great example of cryptography. Ancient Egypt developed the first encrypted messages as a series of disordered hieroglyphics, to prevent the uninitiated from learning the secrets of various mystery schools. This method of encryption was very simple, relying on a technique known as simple substitution.

Suspicious of his messengers, Roman Emperor Julius Caesar sent encrypted messages to his generals. Posthumously named, Julius Caesar popularized the Caesar Cipher. The Caesar Cipher is also a simple substitution technique.

What is hashing?

Hashing is a form of cryptography. A hash function is any function that can map arbitrary-size data to fixed-size values. Values returned by a hash function are called hash values, hash codes, digests, or simply hashes.

For instance, take the plaintext “Hello World.” Using the hashing function of Ethereum, Keccak-256 hashing function, we will convert the plaintext into the hash “592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba.” Correspondingly, the output resembles an Ethereum address.

People unknowingly encounter hashes in their everyday lives. You may encounter hashes on a daily basis using passwords. When you create an account on an application, the provider more than likely does not save your password; they save a hash of your password. When you sign in to your account, the app hashes the password you enter and compares this hash to the hash it has saved on file.

Cryptographic Hash Function Properties

Simply put, not all functions are created equally. Hashing functions must satisfy specific requirements, in order to function properly. They must have the following properties:

Computationally efficient

Computers must be able to return the hash quickly; most can process a hash function in a fraction of a second.

Deterministic

For example, using the Keccak-256 hashing function, we will alter the message “Hello World” to “hello World”. This returns the value “079813c47d3d4ab9abf0c0747f5b5cdf90e0e264ae09ea44fb2509c559b72ac1.” As you can see, our hashing function is case-sensitive, and drastically alters the result of our returned hash.

The exact hash value must be produced every time for a given input value. You must remember that hashing is a way to securely send a message. If this were not the case, then you could alter the input to a hash, unbeknownst to the receiver.

Pre- Image Resistance

A pre-image attack occurs when a hash’s output is known and the task is to find some input. A pre-image attack on a cryptographic hash function seeks a message with a particular hash value. A cryptographic hash function should be resistant to pre-image attacks (set of possible inputs).

You would not want to use the pre-image (i.e. plaintext) as a password in our example “Hello World.” As the plaintext “Hello World” is extremely simple and easy to ascertain. There are databases that keep records of known inputs to even secure hash functions, like SHA-256.

Second Pre-Image Resistance

An expected property of a cryptographic hash function in which finding a second preimage of a known message digest is computationally impossible.

Collision Resistance

It must be extremely difficult, or impossible to find two inputs that produce the same output. Since the input value can be of any length, and any characters, the possibilities for this value are infinite. Outputs have a fixed length and —for that reason— a fixed number of possibilities.

It’s therefore possible for more than one input value to produce the same output. If the collision resistance isn’t strong enough, collisions could be found via a “birthday attack”. You may have noticed that second pre-image resistance and collision resistance are very similar. Rest assured that they are separate, and rather simple.

With second pre-image resistance, an input is known and the attacker is able to find a second input that hashes to the same value. With Collision resistance, both inputs are unknown, and the attacker is able to find both inputs that hash to the same value. Collision resistance implies pre-image resistance.

Birthday Attack

This is an attack that exploits the mathematics behind probability theory. You’ve probably heard of the birthday example; If you have a room of 27 people, although it seems unlikely, there’s actually a 50% chance of two people having the same birthday.

Why is this? One person has a 1/365 probability of having the ‘right’ birthday. The chance of a second person having that same birthday is also 1/365. To find the probability that both have the same birthday, we have to multiply their probabilities. So scaling up, if you have 365 different birthdays and therefore 365 possibilities, you need the square root of 365 which is 23 randomly chosen people for a 50% chance of people matching.

Applying this theory to hashing, we realise that technically; no hash function is collision-free, but with it should take a long time for this to occur!

How is Hashing used in Blockchain?

Bitcoin Total Hash Rate: Blockchain.com

Bitcoin works on a blockchain and uses the hashing algorithm ‘SHA-256’ (Secure Hashing Algorithm 256). For bitcoin, hash functions are used for three mains functions:

Mining

Miners race to solve a puzzle; each miner takes information from blocks they already know about, hash them, and builds a block out of them. If the output from the algorithm is smaller than the target number, then it will be considered valid and can be accepted by the rest of the network. They then have the right to create the next block.

Linking blocks

For added security; each block on the blockchain is linked to the previous one. This is achieved with a hash pointer (variables which store the address of another variable). Basically, each block contains the hash result from the previous block on the blockchain. This ensures that the history of the blockchain can be easily tracked and eliminates the possibility of a malicious block being added.

Creating keys

To send or receive cryptocurrency, you need a private and a public key. These two keys are connected to each other via a hash function. This is an essential component to ensure that nobody can work out your private key based on your public key.

The Importance of Hashing

The hash function gives cryptocurrency a high level of security. Although, in theory, nothing online is immune to hacking; the hash function provides the maximum difficulty level currently available.

Disclaimer:

  1. This article is reproduced from [Beincrypto], and the copyright belongs to the original author [Jessica Lloyd]. If there are objections to the reproduction, please contact the Gate Learn team, and the team will process it promptly according to relevant procedures.
  2. Disclaimer: The views and opinions expressed in this article represent only the personal views of the author and do not constitute any investment advice.
  3. Other language versions of the article are translated by the Gate Learn team. Without mentioning Gate.io, it is not permitted to copy, disseminate, or plagiarize the translated articles.

Share

Crypto Calendar

Project Updates
Etherex will launch the token REX on August 6.
REX
22.27%
2025-08-06
NFT AI Product Launch
Nuls will launch an NFT AI product in the third quarter.
NULS
2.77%
2025-08-06
dValueChain v.1.0 Launch
Bio Protocol is set to roll out dValueChain v.1.0 in the first quarter. It aims to establish a decentralized health data network, ensuring secure, transparent, and tamper-proof medical records within the DeSci ecosystem.
BIO
-2.47%
2025-08-06
AI-Generated Video Subtitles
Verasity will add an AI-generated video subtitles function in the fourth quarter.
VRA
-1.44%
2025-08-06
VeraPlayer Multi-Language Support
Verasity will add multi-language support to VeraPlayer in the fourth quarter.
VRA
-1.44%
2025-08-06

Related Articles

Solana Need L2s And Appchains?
Advanced

Solana Need L2s And Appchains?

Solana faces both opportunities and challenges in its development. Recently, severe network congestion has led to a high transaction failure rate and increased fees. Consequently, some have suggested using Layer 2 and appchain technologies to address this issue. This article explores the feasibility of this strategy.
6/24/2024, 1:39:17 AM
The Future of Cross-Chain Bridges: Full-Chain Interoperability Becomes Inevitable, Liquidity Bridges Will Decline
Beginner

The Future of Cross-Chain Bridges: Full-Chain Interoperability Becomes Inevitable, Liquidity Bridges Will Decline

This article explores the development trends, applications, and prospects of cross-chain bridges.
12/27/2023, 7:44:05 AM
Sui: How are users leveraging its speed, security, & scalability?
Intermediate

Sui: How are users leveraging its speed, security, & scalability?

Sui is a PoS L1 blockchain with a novel architecture whose object-centric model enables parallelization of transactions through verifier level scaling. In this research paper the unique features of the Sui blockchain will be introduced, the economic prospects of SUI tokens will be presented, and it will be explained how investors can learn about which dApps are driving the use of the chain through the Sui application campaign.
6/13/2024, 8:23:51 AM
Navigating the Zero Knowledge Landscape
Advanced

Navigating the Zero Knowledge Landscape

This article introduces the technical principles, framework, and applications of Zero-Knowledge (ZK) technology, covering aspects from privacy, identity (ID), decentralized exchanges (DEX), to oracles.
1/4/2024, 4:01:13 PM
What Is Ethereum 2.0? Understanding The Merge
Intermediate

What Is Ethereum 2.0? Understanding The Merge

A change in one of the top cryptocurrencies that might impact the whole ecosystem
1/18/2023, 2:25:24 PM
What is Tronscan and How Can You Use it in 2025?
Beginner

What is Tronscan and How Can You Use it in 2025?

Tronscan is a blockchain explorer that goes beyond the basics, offering wallet management, token tracking, smart contract insights, and governance participation. By 2025, it has evolved with enhanced security features, expanded analytics, cross-chain integration, and improved mobile experience. The platform now includes advanced biometric authentication, real-time transaction monitoring, and a comprehensive DeFi dashboard. Developers benefit from AI-powered smart contract analysis and improved testing environments, while users enjoy a unified multi-chain portfolio view and gesture-based navigation on mobile devices.
5/22/2025, 3:13:17 AM
Start Now
Sign up and get a
$100
Voucher!