**The Brain of Blockchain**

SHA( Secure Hash Algorithm) 256 A **cryptographic hash** (sometimes called ‘digest’) is a kind of ‘signature’ for a text or a data file. SHA-256 generates an almost-unique 256-bit (32-byte) signature for a text. You can test how a text turns into a digital signature from the link below. A hash is not ‘encryption’ – it cannot be decrypted back to the original text (it is a ‘one-way’ cryptographic function, and is a fixed size for any size of source text).

https://www.movable-type.co.uk/scripts/sha256.html

The **Secure Hash Algorithms** are a family of cryptographic hash functions published by the National Institute of Standards and Technology (NIST) as a U.S. Federal Information Processing Standard (FIPS), including:

**SHA-0**: A retronym applied to the original version of the 160-bit hash function published in 1993 under the name “SHA”. It was withdrawn shortly after publication due to an undisclosed “significant flaw” and replaced by the slightly revised version SHA-1.**SHA-1**: A 160-bit hash function which resembles the earlier MD5 algorithm. This was designed by the National Security Agency (NSA) to be part of the Digital Signature Algorithm. Cryptographic weaknesses were discovered in SHA-1, and the standard was no longer approved for most cryptographic uses after 2010.**SHA-2**: A family of two similar hash functions, with different block sizes, known as*SHA-256*and*SHA-512*. They differ in the word size; SHA-256 uses 32-byte words where SHA-512 uses 64-byte words. There are also truncated versions of each standard, known as*SHA-224*,*SHA-384*,*SHA-512/224*and*SHA-512/256*. These were also designed by the NSA.**SHA-3**: A hash function formerly called*Keccak*, chosen in 2012 after a public competition among non-NSA designers. It supports the same hash lengths as SHA-2, and its internal structure differs significantly from the rest of the SHA family.- (https://en.wikipedia.org/wiki/Secure_Hash_Algorithms)

Although not all hash functions involve the use of cryptography, the so-called cryptographic hash functions are at the core of cryptocurrencies. Thanks to them, blockchains and other distributed systems are able to achieve significant levels of data integrity and security. (https://academy.binance.com/en/articles/what-is-hashing)

Conventional hash functions have a wide range of use cases, including database lookups, large files analyses, and data management. On the other hand, cryptographic hash functions are extensively used in information-security applications, such as message authentication and digital fingerprinting. When it comes to Bitcoin, cryptographic hash functions are an essential part of the mining process and also play a role in the generation of new addresses and keys.

a hash function that deploys cryptographic techniques may be defined as a cryptographic hash function. In general, breaking a cryptographic hash function requires a myriad of brute-force attempts. For a person to “revert” a cryptographic hash function, they would need to guess what the input was by trial and error until the corresponding output is produced. However, there is also the possibility of different inputs producing the exact same output, in which case a “collision” occurs.

Technically, a cryptographic hash function needs to follow three properties to be considered effectively secure. We may describe those as collision resistance, preimage resistance, and second preimage resistance.

Before discussing each property, let’s summarize their logic in three short sentences.

- Collision resistance: infeasible to find any two distinct inputs that produce the same hash as output.
- Preimage resistance: infeasible to “revert” the hash function (find the input from a given output).
- Second-preimage resistance: infeasible to find any second input that collides with a specified input.
- (https://academy.binance.com/en/articles/what-is-hashing)

**Immutability**

One thing that blockchain is known for is its ability to be immutable. When people talk about the “immutability” of blockchain, they are referring to the inability to make adjustments to the data after it is recorded and stored. This is very important when dealing with any type of blockchain. Here are four of the many reasons for why a blockchain is immutable.

- One way encryption: What makes blockchain unique is the fact that it is one-way encryption on any input. There is virtually no decryption key because it is a unique encryption every time. The encryption is strongly based on the data that someone puts in, meaning that the same data will always
- Salting: Salting is the act of adding random data as an additional security measure. It is used on top of the one-way encryption. Essentially, it adds more information to whatever the blockchain is about. This essentially randomizes the output. For example, if you have a password and a salt value. The salt value will be added to the password so that it does not make sense and hackers won’t understand what it means.
- It is decentralized: One of the most exciting aspects of blockchain technology is that it is entirely decentralized, rather than stored in one central place. This removes the need for powerful central authorities who have control over everything. Instead, several individual users have small amounts of power. When it is stored on different computers, the computers are referred to as nodes.
- Each block stores the value of the previous one: The original block is known as the genesis block. When another block gets added the previous block holds the hash value of the one in front of it. For example, if we start at the genesis block, it will hold the value of block number two. As soon as tampering starts to happen with a singular block, it completely changes the hash value of that block. Now if a certain block has tampered with that means that the previous block wouldn’t recognize the hash. As soon as this happens the entire system shuts down.

As you can see immutability is just emphasizing on the fact that blockchain is very secure and well designed.

### Enabling Proof of Work Mining

SHA-256 was the first hashing algorithm used for verifying transactions on a blockchain network via a Proof of Work consensus mechanism. It’s important to note that Bitcoin wasn’t actually the first Proof of Work system. HashCash, a Proof of Work algorithm invented in 1997, is widely considered to be the first implementation. Satoshi Nakamoto cited HashCash as an influence for the Bitcoin network in the white paper: “To implement a distributed timestamp server on a peer-to-peer basis, we will need to use a proof-of-work system similar to Adam Back’s Hashcash.”

In basic terms, SHA-256 supports a Proof of Work network in which computers race to solve a complicated math problem. After one computer finds a solution, it broadcasts that solution to the rest of the computers on the peer to peer network. This *proves their work* to the other machines that were trying to solve the same problem, as each computer on the network verifies the solution independently. If the solution is found to be accurate, the miner who found it is given a reward. Then, a new problem is presented and the competition begins again.