Bitcoin and all the Altcoins are built on top of the blockchain platform that uses cryptography to secure the transactions.
Cryptography is the practice and study of techniques for securing information or preventing third parties or the public from reading private messages.
The cryptography literature often uses the name Alice ("A") for the sender, Bob ("B") for the intended recipient, and Eve ("eavesdropper") for the adversary.
SHA-2 is a set of cryptographic hash functions designed by the United States National Security Agency (NSA). Bitcoin uses SHA-256 which can take an input of random size and produce an output of a fixed size. This helps secure transactions since it is almost impossible to reproduce the input from the given output and makes it an ideal protocol for the Bitcoin network.
Some of the Altcoins use different cryptographic hash functions i.e. Scrypt.
Input (type or paste your message in here) :
Output (SHA256 result based on input) :
The SHA-256 hash function is utilised within the Bitcoin network in two main ways.
- Creation of Bitcoin addresses
A miner needs to perform a task called a proof-of-work. This is essentially the process of computing the hash function. Once the miner solves the hash function for that block of transactions, it is then relayed to the network to be checked against the consensus rules
In Bitcoin address creation, a public key needs to be hashed (which also uses SHA256). Hashing a public key to produce a Bitcoin address adds an extra layer of protection