Note
If you are new to the field of information technology, taking our Free Information Technology Course for Beginners and Cloud Technology Course for Free with Certification is highly recommended. Also, for a comprehensive coverage of blockchain concepts and its use cases, taking our Free Blockchain Course with Certification is highly recommended.
Recap
In our previous article (How Public and Private Keys of Cryptography Work), we covered how cryptography works and what role it plays in a blockchain system. We also go over differences between public and private keys of cryptography.
In this article, we continue our discussion on cryptography by discussing how its hash function works.
One-to-One Live Blockchain Classes
Coding Bootcamps school offers One-to-One Live Blockchain Classes for Beginners.
Cryptographic hash function
A cryptographic hash function is an algorithm used to randomly convert a string of binary data into a condensed representation of a message—a message digest. Its output is called a hash value, digital fingerprint, digest, or checksum. It is deterministic and always results in the same hash value for a given message. It is capable of taking any size of data block and producing a fixed-size hash value that uniquely identifies the original data block. It is a one-way, irreversible function; the only way to recreate the input data is to try a brute-force approach with all possible values to see whether there is a match, which is almost computationally infeasible.
Cryptographic functions have been widely used in blockchain technology, including the following:
- Merkle trees: As we showed earlier, when a miner node pulls transactions from the transaction pool, it packages them in a block, where the block header has a field referencing the Merkle root of all transactions.
- Block chaining: Blocks in the blockchain are chained together with a reference to the previous block using a cryptographic hash.
- PoW: The PoW consensus algorithm itself is a game in solving a cryptographic hash function. We will discuss it in more detail in the Understanding the blockchain consensus mechanismarticle.
Next Article
In the next article (How Digital Signature Works In Blockchain), we move on to the next topic which is how Digital Signatures work and what role they play in a blockchain system.
This article is written in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book. He has written 7 books on blockchain development.
Resources
coming soon