Unblocking the Blockchain: Hashing
What is Hashing?
From the previous two articles, we learned that Digital Signatures prove that a message originates from a specific person and no one else. Digital Signatures ensure message authentication as they can be used to assure the participants of a transaction that the information originated from the signer and can be trusted.
In this article, we are going to explore the second cryptography concept that is essential in a blockchain network known as Hashing.
The process of applying the Hash function is called "Hashing". Hashing is a confirmation that the output from a Hash function has not been tampered with in any way. Hashing transforms a string of characters into a value that uniquely represents the original string. Bitcoin, for example, uses SHA-256 algorithm to take an input and turn it into a fixed size of 256-bit (32-byte) output. For example,
BLOCKCHAIN - dffdca1f7dd5c94afea2936253a2463a26aad06fa9b5f36b5affc8851e8c8d42
blockchain - ef7797e13d3a75526946a3bcf00daec9fc9c9c4d51ddc7cc5df888f74dd434d1
SHA stands for Secure Hash Algorithm. Blockchain uses 256 bits of information to represent its current state at any given time.
Let us attempt to use bar codes to explain the concept here. A bar code is an image of bars and spaces that is used to identify a particular product. For an example, in a supermarket, a bar code uniquely represents the item which itself is affixed to. However, it is difficult to guess the products by just looking at the bar codes.
Verifying the Checksum of Files
In computer security systems, Hashing is used to ensure that transmitted messages have not been tampered with.
In situations when you are downloading a file, you may be able to see the checksum values being included, so you can verify if the downloaded file has been corrupted or not. Example:
Hashing allows one to ensure that the file is identical and that no corruption has occurred during the download.
Once you have downloaded the file, you can verify if the downloaded file and the published checksums match.
Use the built-in CertUtil utility
Open the command prompt in Windows
Navigate to the folder of the downloaded file
Run the following command:
C:\>CertUtil -hashfile / SHA256
Run the following command:
shasum -a -256 /Users/<path name>/videos/Blockchain_FINAL_040518.mp4
Check the SHA-256 hash values to match against the one from the original file.
Characteristics of a Good Hash Function
Hashing has the following characteristics, which makes it suitable for Blockchains.
- Difficult to predict what the hash of any input will be until you calculate it.
- Computationally Efficient
- Collision Resistant – Difficult to find two inputs that match to one same output
- Hides Information - Difficult to glean anything useful about the input given the output.
- Well Distributed – The output should look random
Hashing in the Blockchain
Blockchain keeps an entire list of transactions by linking together a series of timestamped data records that are immutable. There is no central authority in a Blockchain. Participating parties in a blockchain network need an assurance of trust that a record has not been tampered with or modified in an unauthorised way.
Hashing provides that. It represents the current state of the transactions that have taken place so far.
In Blockchain, transactions are linked together in a chronological manner to form a continuous chain of blocks. Hashing provides the security of the data. We will look at how Hashing is being used in Blockchain in the next article.
Hashing is also used in Bitcoin where miners are required to find the hash of the block header to start with a certain number of zeros. We will cover this later.
- Unblocking the Blockchain: Cryptography and Digital Signatures
There are two main cryptographic concepts that form the basis of a Blockchain network. The first is hashing, and the second is digital signatures. A Digital signature proves the identity of a sender with the private key that claims ownership of asset
This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.
Questions & Answers
© 2018 Heng Kiong Yap