Till now most people from a variety of fields know what blockchain is and understand that its breakthrough technology has the potential to disrupt various industries. Blockchain is immutable and forge-proof making them the best platform for data related transactions. Blockchain helps prevents a diverse range of fraud including identity theft, financial forgery, data theft and more. While collecting the necessary information about Blockchain, how it works and its applications, most of us misunderstand the mechanism behind the tamper-proof nature of this technology. The key to Blockchain security and tamper proof nature is ‘Cryptography’.

Cryptography contributes to maintain the security of the network. It makes data manipulation hard or impossible and offers high-level protection to each user. It is because of cryptography that users enjoy transparent transactions while keeping their privacy intact.

**Blockchain Cryptographic Features**

It is because of the cryptographic features of Blockchain that users enjoy high-level integrity. Two primary elements that make Blockchain such a robust platform are:

- Cryptographic Hash Functions
- Digital Signatures

There is no correlation between your trade success and knowledge of these features as one can invest in bitcoin without knowing anything about cryptography. If, however, you are interested in the technological aspect of this fantastic platform, cryptography or encryption is an interesting aspect that you must know.

**Hash Functions**

Hash functions are the base of an encrypted network. They are the reasons Blockchain is a reality today and so it is crucial that we understand them. Hash functions became popular in the 1960’s when researchers and scientists first realised how their potential could prove revolutionary in the field of computing. In technical language, hash functions are a type of services that are responsible for returning a string of characters of a fixed size from a dataset of arbitrary size. Similarly, cryptographic hash functions are hash functions that have critical application in cryptography and contain features that are highly useful as discussion below:

- Hash functions are
**deterministic**: this means whenever you set any input, it will always produce the same results. - They can be
**disruptive**: This means that changing the information can bring considerable changes in the output. - Easy and instant to compute.

The US National Institute of Standards and Technology published Secure Hash Algorithm (SHA), which is a family of hash functions. Most blockchains use SHA or other similar cryptographic hash functions to ensure the flow of information. Bitcoin uses SHA-256.

**Cryptography and Passwords**

Understanding cryptography and passwords can be difficult if not explained through an example. Let’s use this easy example to help you understand the critical use cases of hash functions. Let us assume the John and Joe are members of a society where they need a secret password to prove their membership to each other.

Now in the first instance, Joe can merely ask John if he has the secret password or not. If he does, he must provide it to Joe to prove his membership. However, John, not being sure about the association of Joe, is sceptical about sharing the password with her.

Here hash functions serve as the problem solver.

Let us suppose that the password is: Lionel Messi is a phenomenal football player.

To prove their membership, both John and Joe can use a hash function input (the passphrase of the password in Hash function) and see if it brings the same output.

They can check and compare each other’s password and testify whether or not they are both are members of the same group. A minor change in the password Hash will cause results to drastically differ.

**How does cryptographic hash function in Blockchain?**

Any unconfirmed transaction broadcasted to the Blockchain network is directed to the unconfirmed cloud. In this unconfirmed cloud, hundreds and thousands of nodes in the network work hard, sorting and solving a puzzle by rearranging the transactions. It is similar to inserting a row at the end of an excel spreadsheet where previous rows are getting locked.

The various part of the spreadsheets include:

**Hash Of The Previous Block**

It is a must for each block in the Blockchain to contain the hash function of the last block in the chain. In simpler terms, the output of the previous block of the hash function has to be accounted for in the present block.

**List of Unconfirmed Transactions**

Miners have to sift through the list of unconfirmed transactions present in the unconfirmed transaction cloud and choose their activities. For this, miners choose the activities that promise the highest transaction fees.

**Miner’s Address**

It contains miner’s address, and all the mining rewards go to this address.

**Random Number**

It is the number that completely changes the hash function of the block. It is one critical factor that contributes to solving the secret puzzle.

To solve the secret puzzle, miners have to find a hash with a certain number of zeroes at the start of the Hash. The more number of zero at the start, the smaller the Hash is considered.

Are you wondering how miners successfully find the smallest size of hash? It is an outcome of trial and error.

Only when the hash is small can it be added to the blockchain. Nodes instantly cancel any large Hash added to the blockchain by any other node. The complexity and difficulty level of the puzzles is continuously set and adjusted to ensure each problem takes a fixed amount of time to be solved. For bitcoin, the speculated time to solve a mystery is approximately 10 minutes, and for Ethereum, it is 15 seconds.

It occasionally happens that two nodes find two different solutions for the same puzzle at the same time. It happens when a temporary split occurs in the blockchain wherein half of the nodes support one solution while the other half supports another idea.

In such cases, to solve the ambiguity of the chain, the golden rule of blockchain is applied.

“The longest blockchain is the true blockchain.”

It eliminates the scope of arguments as the nodes accept the block that is allowed at the first moment and continues to build the blockchain on that. In this way, all the nodes on the network have to ditch the old blockchain and join the new most extended chain as the official blockchain.

**Digital Signatures **

Digital signature acts as a filter and protector to check any unauthorised and suspicious activities on the network.

With digital signatures the recipient of a message is allowed to confirm two things:

- The message came from the right person
- The message arrived untampered throughout the transit

Checking the authentication of the transaction in a block is the first thing a node checks when it receives a new block from another node. The authentication happens through public and private keys. The private key allows you to have unique access to your account. It is how accounts differ in a blockchain. To gain access to your account, funds, assets and information stored in it, you needs this private key. As a result, it is mandatory to keep your private key. Each private key has a connected public key which in simpler terms is the hash of the private key.

The public key, also known as the address of the account is a generic number which is shared with anyone on the network or server.

Digital signatures, in this case, are used by someone, who has received the transaction, to confirm that the sender of the transaction or the message knew the corresponding private key.

It is a two-step process wherein the owner of the essential private key needs to:

- Use a cryptographic hash function to feed the message
- Use the output of the hash function and feed it along with a private key using a signature algorithm.

After this, the recipient has to send out:

- Your public key
- Your message or transaction
- Your digital signature

A recipient to authenticate the same word or message has to:

- Use a cryptographic hash function to feed the incoming signal. Use signature verification algorithm to feed the incoming signature and public key; it will produce a hash
- Compare the two hashes, when the hashes are same, the message is authentic.
- This way, the public key is used to verify that a message is authentic as it produces the same hash as your message.