Blockchain is a constantly growing ledger that keeps a permanent record of all the transactions that have taken place, in a secure, chronological and immutable way. To make the data secure blockchain uses hash function.

**Hashing:**

In simple terms, hashing means taking an input string of any length and giving out an output of a fixed length. The fixed-length output is called an equivalent hash or simply hash.

**Types of cryptographic hash functions:**

- Secure Hashing Algorithm (SHA-2 and SHA-3)
- RACE Integrity Primitives Evaluation Message Digest (RIPEMD)
- Message Digest Algorithm 5 (MD5)
- BLAKE2

**SHA-256:**

SHA-256 is the most famous of all cryptographic hash functions because it’s used extensively in blockchain technology. SHA-256 Hashing algorithm was developed by the National Security Agency (NSA) in 2001.

**Hashing process:**

For this hash function we can use Anders Brownworth Hash Program, a program developed by Anders Brownworth.

If we type any character in the data section, we will observe its corresponding cryptographic hash in the hash section.

**Small Changes In The Input Changes the Hash:**

If we make a small change in the input, the equivalent hash produced will be entirely different.

Changing the capital “T” to small “t” completely changed the equivalent hash.

It is very difficult to determine the original string from the equivalent hash but its not impossible. The only method to determine the original string from its hash is by using “brute-force”. Brute-force basically means that we have to take random inputs, hash them and compare them with the target hash.

There can be basically three scenarios:

**Best case scenario:**

We get our answer on the first try. The odds of this happening are astronomical.**Average case scenario:**

In case of SHA-256 we get our answer after 2^256/2 = 2^255 times. In other words, its a huge number.**Worst case scenario:**

We get our answer at the end of data.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Cryptographic Hash Function in Java
- Passwords and Cryptographic hash function
- Blockchain in Brief
- Blockchain Forks
- Features of Blockchain
- What Are Cryptoasssets in Blockchain
- Blockchain vs Bitcoin
- How Does the Blockchain Work?
- Consensus Algorithms in Blockchain
- Blockchain | Smart Contracts
- Implementation of Blockchain in Java
- Guidelines for learning Blockchain
- How does BlockChain support Crowdfunding ?
- Blockchain to Secure IoT Data
- Basics of the Blockchain and its various applications
- Proof of Stake (PoS) in Blockchain
- Introduction to Blockchain technology | Set 1
- Important Blockchain terminologies
- Difference between Blockchain and a Database
- Introduction to Blockchain technology | Set 2

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.