What is Hashing and How Does It Work?

Update 21 Feb 2023 • Reading Time 3 Minute
Image What is Hashing and How Does It Work?
Reading Time: 3 minutes

We’ve already covered the basics of how Bitcoin works. But what about a more detailed mining process? the Bitcoin mining process is a method of processing and securing data such that it is permanent and unchangeable. This solution eliminates the requirement for a third party or a central authority to carry out Bitcoin transactions. To understand how Bitcoin works, we must start with the most fundamental concept: hashes.

What Are Hashes?

A hash is a fixed-length alphanumeric code used to represent a word, message, or data. Hash is a fingerprint or summary of digital data. The difference between hash and encryption is that hash is one-way cryptography, while encryption is two-way. Hashes have basically two characteristics: a) the same input will always produce the same output, and b) there is no function or way to reverse the output back into input.

Hashing means the process of creating a fixed-size output from a variable-size input. This is accomplished through the use of hash functions, which are mathematical formulas (implemented as hashing algorithms).

Every crypto asset uses different hashing algorithms to generate different types of hash codes – these algorithms will generate random alphanumerics. This alphanumeric code is actually a number written in hexadecimal notation whose writing is as follows.

what is hashing 1

For example, Bitcoin uses a hashing algorithm called SHA-256. Through this hashing algorithm, one input value will always produce the same output or hash value.

Let’s see a detailed example as follows:

block-image size-large">what is hashing 3
  • If we enter the word ‘pintu’ into the SHA-256 hash algorithm, the result will always be 24d52030496d5935c5929564269fae1194db553c0ca3e2ede7a4ecc836f134d3
what is hashing 2
  • But if we change the word to ‘p1ntu’ then the hash will change to 9324c6f589fcaccd7c1b93aa2055d638d22cd89893cde131ca91956c69647600.
  • There is no algorithm function that can reverse ’24d52030496d5935c5929564269fae1194db553c0ca3e2ede7a4ecc836f134d3′ back into the word ‘pintu’.

You can try the SHA256 functionality yourself using a website like https://emn178.github.io/online-tools/sha256.html. Try writing the word pintu like the example above and see if the hashes you get are similar.

By running a hashing algorithm, the input data will always produce the same output, but we cannot guess the input data by entering the output.

In proof-of-work, the hash will be inserted into the block and the valid block must meet certain criteria, i.e. the hash of the block must have a small value after undergoing the hashing algorithm. In other words, mining is the process of generating a hash with a specific target by changing one parameter. Miners can change a parameter called nonce. In other words to get the hash according to the target the miner has to try again and again by changing the parameters and running the algorithm.

Conclusion

Bitcoin uses cryptography to secure data on the Bitcoin network. The hash function goes one way. One input will produce the same output. With hash, we can’t guess the input only by the output. If there is a slight change in the data, the hash value will change completely. So that data or transactions in the Blockchain cannot be changed or falsified. This makes the data in the hash safe and secure.

Author:Dea Rezkitha

Share