47: Keccak256
Keccak256
Keccak256 is a hashing algorithm used in Ethereum Blockchain. It is a member of the SHA-2 family and was developed by the team behind the SHA-3 standard. Keccak256 is used to hash transactions and data stored on the Ethereum blockchain and is used as part of the consensus algorithm to determine the validity of transactions.
Example
Example 1 The following example will demonstrate how Keccak256 works:
Let's say we have a string Hello World and we want to hash it using Keccak256.
The steps are as follows:
Calculate the SHA-3 hash of the string using the Keccak-256 algorithm. The result is the hash:
Example 2 Let's take another example, this time with a hexadecimal string:
Calculate the SHA-3 hash of the string 0x1234 using the Keccak-256 algorithm. The result is the hash:
Example 3 Finally, let's take an example with a longer string:
Calculate the SHA-3 hash of the string Hello Ethereum! using the Keccak-256 algorithm. The result is the hash:
Further Reading
Keccak256 - Web3js
Keccak256 is a cryptographic hash function used to generate a fixed-size string of characters from a given input. It is used in Ethereum to generate the address of an account from the public key.
Usage Keccak256 is used to generate cryptographic hash values from input data. It can be used to process data such as passwords, private keys, and Merkle root hashes. It is also used to generate the address of an Ethereum account from a public key.
Examples Here are some examples of how to use the Keccak256 function:
Hashing a Password
That's it for the lesson 47! In the next lesson, Function Signature Hash
Last updated