Introduction to Ethereum's Keccak-256 Algorithm - RugDoc Wiki (2024)

Table of Contents
Pros # Cons # FAQs

Have you ever executed a transaction on the Ethereum (ETH) blockchain? Then you have used the Keccak-256 hashing algorithm. You might ask yourself: huh, did I really do that? Yes, because you use Keccak-256 to sign a transaction on Ethereum.

Keccak-256 is an algorithm that allows us to convert information into an unreadable hash. By an unreadable hash we mean a string of characters that you can see as a kind of secret code. We can convert a text with Kecccak-256 into a set of characters so that the original text remains secret.

There are many reasons to use a hashing algorithm on a blockchain like Ethereum. Let’s take a quick look at what Keccak-256 is and how this hashing algorithm works.

Hashing is encoding data into a hash. This means that we convert a text into a kind of secret code. At first glance, such a hash appears to consist of a number of randomly chosen characters. But in reality, it’s not that random at all. What the hash looks like is determined by the hashing algorithm used. Such an algorithm converts a string into a hash according to a certain logic. Therefore, the same content will always look like the same hash.

With a secure hashing algorithm, nobody knows how the algorithm actually works. This ensures that you can convert the content to a hash, but that you cannot determine the content based on the hash. There are also some algorithms that have been broken over time, such as MD5. With these algorithms, we succeeded in cracking the logic behind the algorithm, so that the outcome could be converted into the input. Why is that so bad? It is then no longer possible to actually secure data. Everyone can view the data. There are several tools available on the internet that allow you to convert MD5 hashes back to the content.

Introduction to Ethereum's Keccak-256 Algorithm - RugDoc Wiki (1)

Keccak-256 is a hashing algorithm that comes from the SHA-3 family. This means that in many ways it resembles the SHA hashing algorithm. Yet there are also differences, which is why the name between the algorithms also differs. What these differences are, we will explain further in this article.

With Keccak-256 it is possible to convert an input to a hash output. This output is always a fixed length: it consists of 256 bits (bytes32). Keccak-256 is a one-way hash function. This means that the hash only works one way. So, you can convert the input to a hash, but it is not possible to determine the content based on the hash.

The hash is not created using keys. When data is secured with a public and private key, we speak of encryption or cryptography. Cryptography is often confused with hashing. However, both techniques are used for cryptocurrencies. Keccak-256 is the hashing algorithm of Ethereum (ETH).

Keccak-256 is part of the Keccak family. In addition to Keccak-256, there are a number of other hashing protocols that fall within the Keccak family. These are:

  • Keccak-224;
  • Keccak-384;
  • Keccak-512.

Keccak-256 is mainly and only used by Ethereum. We see that not only central systems use hashing algorithms. Decentralized systems, to which the blockchain belongs, also use hashing protocols. This is necessary, because sensitive data is stored on the blockchain, just like on any other central server or computer.

If we were to store raw data on a blockchain, it would be possible for everyone to view the data. That would mean that the data is not stored 100% securely. Instead, it is better to store data encrypted: you will then only see a hash. You cannot determine what the content looks like from this hash. As an outsider, this hash is therefore of no use to you.

While algorithms such as SHA-256 are often used for storing passwords and checking the integrity of data, Keccak-256 is mainly and only used by the Ethereum blockchain.

The Ethereum blockchain uses the Keccak-256 hashing algorithm. Specifically, Keccak-256 is used within Ethereum’s Ethash engine. That already starts with Solidity; this is the programming language that developers use on the Ethereum blockchain. Within this programming language, a hash function must encode the data input. This is necessary to encode all ‘contract calls’ (invoking a smart contract) to the EVM. The EVM (Ethereum Virtual Machine) is the machine where developers develop their decentralized applications (dApps).

Digital signatures

When we perform a transaction on the blockchain, we sign it with a digital signature. For such a digital signature you need a public key and a private key. By combining these with each other, a new outcome is created. This outcome is secured with Keccak-256. The algorithm therefore has a very important role in the execution of transactions.

A block consists of a large number of transactions. These transactions have been validated by the validators in the Ethereum network. The transactions are then aggregated and converted to a hash. This is done by means of Keccak-256.

Before that happens, the hash of the last block is first added to the new block. Only then is the new block converted to a hash. What the hash looks like is determined by the content of the block. Should a criminal/hacker ever want to change the history of the blockchain by modifying a block, the block’s hash will change. Then all the hashes of the blocks added next will change. There is clearly a break in the chain.

The moment this happens, all nodes in the network will notice the break. The version of the blockchain that has been modified is then not adopted by the nodes. Hashing therefore plays an important role in the security of the blockchain.

This hashing algorithm has its own advantages and disadvantages. The algorithm is therefore more suitable for one application than for another.

Pros #

  • It has infinite input space. This allows developers to hash large amounts of text using Keccak-256 (for example, SHA-256 has a maximum space of 264 bits).
  • The entire hash comes out different when even one bit of data within the input changes. This makes a hash extremely secure, as it is virtually impossible to find the logic behind the hashing algorithm.
  • It is virtually impossible for the output of data to be the same, which makes performing a brute-force attack on Keccak-256 pointless.
  • Computers and machines can create Keccak-256 hashes at lightning speed, so that the algorithm contributes to the fast operation of the decentralized applications that run on the blockchain.
  • Keccak-256 is used within Solidity. Solidity is the most used and most popular programming language for dApps. This means that the majority of blockchain developers can use a secure hashing algorithm such as Keccak-256.

Cons #

It is not 100% sure that Keccak-256 will always be safe. In the future, a computer could break the algorithm, as computers become smarter and faster. So the question is whether we can always continue to use Keccak-256 for Ethereum. Also, we don’t know what happens when the algorithm breaks.

At the moment, Keccak-256 is a secure hashing algorithm. The algorithm has never been broken. That means no one has been able to reverse a hash to its contents. The moment data is converted to a hash using the Keccak-256 algorithm, the hash can therefore be safely stored.

The fact that Keccak-256 is so safe is of course not entirely without reason. There are several reasons why Keccak-256 is so safe:

  • Double output virtually impossible – The chance of a so-called ‘collision’ occurring is virtually nil. The number of possible outcomes is greater than the number of atoms in our universe. This indicates how low the probability of a collision is.
  • Works one way – You can convert information to a hash, but it is impossible to convert a hash back to the content. This means that you can safely store the hash and no one can do anything malicious with it.
  • One change makes a completely different hash – Even if you change just one bit, the hash looks completely different. This makes it impossible to unravel the logic behind the algorithm.

Keccak-256 is used by Ethereum, while SHA-256 is used by Bitcoin (BTC). They are both used as a hashing algorithm, although they differ from each other. Let’s take a look at the main differences between Keccak-256 and SHA-256.

  • SHA-256 stems from the SHA-2 standard with a 256 bit key, while Keccak-256 is a function within Solidity and stems from the SHA-3 family.
  • Keccak-256 is stronger than SHA-256.
  • SHA-256 generates a SHA-256 hash, while Keccak-256 generates a Keccak-256 hash.
  • Ethereum uses Keccak-256 within its Ethash consensus engine, while Bitcoin uses SHA-256 for transaction hashes and BTC mining.

Keccak-256 is the hashing algorithm of the Ethereum blockchain. This algorithm secures the data on Ethereum. A hashing algorithm ensures that information is converted into a hash. This hash looks like a set of random characters, although it’s actually not that random at all. An algorithm determines what the hash looks like.

It is impossible to convert a hash back to the content. Therefore, we can only use hashing to compare its output (the hash) with each other. This way we know whether the content is the same, without actually retrieving the content. When even one bit looks different, the whole hash looks different too. This makes a hashing algorithm like Keccak-256 secure.

Introduction to Ethereum's Keccak-256 Algorithm - RugDoc Wiki (2024)

FAQs

What is the Keccak 256 algorithm of Ethereum? ›

Keccak256 is a cryptographic hash function that takes an input of an arbitrary length and produces a fixed-length output of 256 bits. It is the function used to compute the hashes of Ethereum addresses, transaction IDs, and other important values in the Ethereum ecosystem.

What is the difference between SHA256 and Keccak 256? ›

SHA-256 is the implementation of the SHA-2 standard with a 256 bits key. Keccak256, a cryptographic function, is part of Solidity (SHA-3 Family). 2. The SHA-256 is weaker than Keccak-256.

What is the Keccak algorithm? ›

Keccak [5] is a cryptographic hash function selected as the winner of the NIST hash function competition in 2012. Keccak is known for its high level of security and resistance to collision attacks. ...

What is the Keccak function in solidity? ›

Keccak256 is a cryptographic hash function used in Solidity, the programming language for Ethereum smart contracts. It is based on the SHA-3 algorithm and provides an important security feature by ensuring data integrity and authenticity.

Is Keccak secure? ›

The sponge and duplex constructions used by Keccak are provably secure against generic attacks. This covers also the joint use of multiple Keccak instances with different rate/capacity parameters.

How blockchain uses sha-256? ›

SHA-256 is often used with public-key cryptography to create digital signatures. It allows for the verification of the integrity and authenticity of digital messages or documents. SHA-256 plays a fundamental role in blockchain technology.

Why is SHA-256 so popular? ›

Many consider SHA-256 to be one of the most secure hashing algorithms today. This is because it's great at preventing values from being reversed back to the original content. Another problem that it solves well is avoiding hashing collisions. This means that two separate inputs cannot produce an identical hash.

Is there a better algorithm than SHA-256? ›

SHA-256 is a secure algorithm and is the most widely used. It is computed with 32-bit words. SHA-512 offers better security than SHA-256, but it is not widely used as of now. It is computed with 64-bit words.

How to decode keccak256? ›

The keccak256 (SHA-3 family) algorithm computes the hash of an input to a fixed length output. The input can be a variable length string or number, but the result will always be a fixed bytes32 data type. It is a one-way cryptographic hash function, which cannot be decoded in reverse.

What is the structure of Keccak? ›

Structure of Keccak

In Keccak, the underlying function is a permutation chosen in a set of seven Keccak-f permutations, denoted Keccak-f[b], where b∈{25,50,100,200,400,800,1600} is the width of the permutation. The width of the permutation is also the width of the state in the sponge construction.

What is the strongest SHA algorithm? ›

Final Thoughts on What Is the Most Secure Hashing Algorithm

To the time of writing, SHA-256 is still the most secure hashing algorithm out there. It has never been reverse engineered and is used by many software organizations and institutions, including the U.S. government, to protect sensitive information.

What is the usage of Keccak256? ›

Keccak256 is an essential component of the Ethereum blockchain, serving as its primary hash function. It is used for various purposes, including: Generating unique identifiers for transactions and blocks. Computing the addresses of smart contracts.

Is sha256 the same as Keccak256? ›

SHA-256 stems from the SHA-2 standard with a 256 bit key, while Keccak-256 is a function within Solidity and stems from the SHA-3 family. Keccak-256 is stronger than SHA-256. SHA-256 generates a SHA-256 hash, while Keccak-256 generates a Keccak-256 hash.

What is the difference between Keccak and SHA-3? ›

The Keccak team who created the algorithm confirmed that the actual algorithm was not changed in SHA-3. NIST only changed the padding thus it's the reason that changes the hash from Keccak. The security of the algorithm is not changed from the original Keccak.

Is Keccak256 unique? ›

Keccak256 in Cryptocurrencies

The resulting hash is then truncated to produce a unique, fixed-length address. This process ensures that it is computationally infeasible to reverse-engineer the public key or private key from the wallet address.

What algorithm is used in Ethereum? ›

Ethereum uses the Keccak-256 cryptographic hash function in many places. Keccak-256 was designed as a candidate for the SHA-3 Cryptographic Hash Function Competition held in 2007 by the National Institute of Science and Technology.

Is ETH a SHA256? ›

The Bitcoin blockchain uses the SHA256 algorithm, which produces a 32-byte hash. Dogecoin and Litecoin both use Scrypt, which is one of the faster and lighter cryptography algorithms. Does ethereum (ether) use SHA-256? Yes.

Top Articles
The richest person who ever lived - BBC Reel
2023 In Review and 2024 Market Outlook
11 beste sites voor Word-labelsjablonen (2024) [GRATIS]
Craigslist Myrtle Beach Motorcycles For Sale By Owner
Diario Las Americas Rentas Hialeah
Riverrun Rv Park Middletown Photos
Mrh Forum
Chelsea player who left on a free is now worth more than Palmer & Caicedo
Craigslist Nj North Cars By Owner
Nation Hearing Near Me
Daniela Antury Telegram
Breakroom Bw
Meritas Health Patient Portal
Chastity Brainwash
Uky Linkblue Login
Directions To Advance Auto
Buy Swap Sell Dirt Late Model
H12 Weidian
China’s UberEats - Meituan Dianping, Abandons Bike Sharing And Ride Hailing - Digital Crew
If you bought Canned or Pouched Tuna between June 1, 2011 and July 1, 2015, you may qualify to get cash from class action settlements totaling $152.2 million
Uconn Health Outlook
Healthier Homes | Coronavirus Protocol | Stanley Steemer - Stanley Steemer | The Steem Team
Craigslist Clinton Ar
zom 100 mangadex - WebNovel
Maxpreps Field Hockey
Ac-15 Gungeon
Scheuren maar: Ford Sierra Cosworth naar de veiling
Gilchrist Verband - Lumedis - Ihre Schulterspezialisten
1145 Barnett Drive
Snohomish Hairmasters
Paris Immobilier - craigslist
Copper Pint Chaska
Times Narcos Lied To You About What Really Happened - Grunge
Nurofen 400mg Tabletten (24 stuks) | De Online Drogist
Memberweb Bw
John F Slater Funeral Home Brentwood
Aliciabibs
Watchseries To New Domain
Muziq Najm
Thelemagick Library - The New Comment to Liber AL vel Legis
Easy Pigs in a Blanket Recipe - Emmandi's Kitchen
Lyndie Irons And Pat Tenore
Canvas Elms Umd
Neil Young - Sugar Mountain (2008) - MusicMeter.nl
Best Restaurant In Glendale Az
Pronósticos Gulfstream Park Nicoletti
Craigslist Cars For Sale By Owner Memphis Tn
Www Ventusky
Where and How to Watch Sound of Freedom | Angel Studios
O'reilly's On Marbach
Round Yellow Adderall
Latest Posts
Article information

Author: Saturnina Altenwerth DVM

Last Updated:

Views: 5341

Rating: 4.3 / 5 (44 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Saturnina Altenwerth DVM

Birthday: 1992-08-21

Address: Apt. 237 662 Haag Mills, East Verenaport, MO 57071-5493

Phone: +331850833384

Job: District Real-Estate Architect

Hobby: Skateboarding, Taxidermy, Air sports, Painting, Knife making, Letterboxing, Inline skating

Introduction: My name is Saturnina Altenwerth DVM, I am a witty, perfect, combative, beautiful, determined, fancy, determined person who loves writing and wants to share my knowledge and understanding with you.