What is SHA-256


What is SHA-256

SHA-256 stands for Secure Hash Algorithm — 256 bit and is a type of hash function commonly used in Blockchain. This algorithm is used in Bitcoin and is a key component that makes it work.

Bitcoin is a system that is made out of a network protocol, some core cryptographic functions and a set of game theoretical equilibrium systems that dynamically adjust. Like many technologies, Bitcoin is not entirely new, in fact the core idea in bitcoin is to take several technologies that already existed and match them together to create something completely new. All the components that makes bitcoin existed about 15 years before bitcoin was invented. In this article, we are going to focus on SHA-256.

To understand what SHA-256 is, we need to understand what a Hash Function is. It is a quiet complexe subject especially for newbies that don’t have a computer science background. But at its core, the principles are simple.

A fingerprint for the data

A hash function is a type of mathematical function which turns data into a fingerprint of that data called a hash. Put in simple words, every time your input something (can be any data, any size), SHA-256 mixes it up and will always output the same results. But you have no way of predicting what is going to come out as output.

SHA-256 is deterministic

Obviously the output looks random. If you run any statistical analysis on the output it will looks random, but it is not. SHA-256 is deterministic. Meaning that if you put the same thing on the top, you will always get the same result at the bottom. Always.

Which means that if you have this fingerprint, and someone gives you a piece of data. You can put the data as input, verify the fingerprint and you’ll know if they applied sha-256 to it. So it can be used to prove a certain data set.

echo -n hello | shasum -a 256generate the fingerprint 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 — You can try it by yourself! Open your terminal and type: always the string “hello”

SHA-256 role in Bitcoin

In a bitcoin transaction, there is a random number in the header of the transaction called a Nonce. Miners in the network have to find that Nonce using its fingerprint, and the only way to find the Nonce is to produce quadrillions of hashes operations. And to perform theses operations, they have to use a very important precious ressource: energy.

This algorithm is at the core of bitcoin, it is used to secure the network through proof-of-work. So, just by looking at the fingerprint, I know for sure that the miner had to spend a lot of electricity. Which means that miners had a financial cost, and that is really important for the security of the bitcoin network. Because it creates an economic system where in order to participate, you have to spend ressources, and miners do that for the possibility of reward. And the possibility of reward, is determined by wether your blocks meets the consensus rules. Which means you spend money, and if you play fair by the rules, you get money in return. If you spend money, and you try to cheat, you don’t get money back. So you loose money, therefore, it doesn’t pay to cheat.

Subscribe to our Newsletter to stay informed
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Don't miss these stories:
Crypto Mining trends in 2020 : Mining 2.0

The idea of this article is to share a global vision of the crypto-mining market, the issues and trends that are transforming this market. It’s based on few years of intense experimentation and exchange in the crypto-mining space by the Sesterce Group and myself and introduce what we call at Sesterce the Mining 2.0

Read More
AI & Blockchain: Expectation for two complementary technologies ?

A blockchain is a database accessible to people all over the world and operating without a trusted third party. It uses advanced cryptographic techniques to reward those who process and secure this data (in the case of Proof-of-Work). Since the Ethereum blockchain, this database has become programmable with the implementation of Smart-Contracts, decentralized applications (Dapps), and decentralized organizations (DAOs).

Read More
Blockchain: A miracle for the Art Market?

Today the art market represents more than 14.58 billion euros in transactions. Most works of art have an extrinsic value, which is mainly based on the certificate of authenticity provided by third parties: the artist himself, but also gallery owners, art dealers, auctioneers, museum curators, and private experts. However, according to Bloomberg, nearly 10% of the value of transactions on the art market comes from forgeries.

Read More