As discussed previously, a Blockchain is literally just a chain of blocks connected to form an immutable decentralised ledger. Each block has a block number, data, precious hash, current hash, timestamp, etc… fields that uniquely define the block as shown in the image below.
So, let’s talk more about the “Hash”. Hash code is a unique code generated differently for each block by SHA 256 hashing algorithm.
In encryption, data is transformed into a secure format that is unreadable unless the recipient has a key. In its encrypted form, the data may be of unlimited size, often just as long as when unencrypted. In hashing, by contrast, data of arbitrary size is mapped to data of fixed size. For example, a 512-bit string of data would be transformed into a 256-bit string through SHA-256 hashing.
In cryptographic hashing, the hashed data is modified in a way that makes it completely unreadable. It would be virtually impossible to convert the 256-bit hash mentioned above back to its original 512-bit form. So why would you want to create a scrambled message that can’t be recovered? The most common reason is to verify the content of data that must be kept secret. For example, hashing is used to verify the integrity of secure messages and files. The hash code of a secure file can be posted publicly so users who download the file can confirm they have an authentic version without the contents of the file being revealed. Hashes are similarly used to verify digital signatures.
The SHA-256 algorithm is one flavour of SHA-2 (Secure Hash Algorithm 2), which was created by the National Security Agency in 2001 as a successor to SHA-1. SHA-256 is a patented cryptographic hash function that outputs a value that is 256 bits long.
Whenever any document, image, audio or video data is sent to SHA 256 Algorithm (Let’s consider it as a black box which has an input and gives an output) it converts the data into an encrypted format of 64 Hexadecimal characters of 4 bits each that math up to 256 bits - an example: 5819E961F19967B4ECB2429085E17909CFFD4DCB6267D0067F6CAEC22150A7B1
phew, such extended encryption, well that's important for security cause the average cost of a data breach was $4.24 million in 2021, the highest average on record and Cybersecurity Ventures expects global cybercrime costs to grow by 15% per year over the next five years, reaching $10.5 trillion USD annually by 2025.
What role does SHA-256 hashing play in cybersecurity? SHA-256 is used in some of the most popular authentication and encryption protocols, including SSL, TLS, IPsec, SSH, and PGP. In Unix and Linux, SHA-256 is used for secure password hashing. Cryptocurrencies such as Bitcoin use SHA-256 for verifying transactions.
SHA-256 is one of the most secure hashing functions on the market. The US government requires its agencies to protect certain sensitive information using SHA 256. While the exact details of how SHA-256 works are classified, we know that it is built with a Merkle-Damgård structure derived from a one-way compression function itself created with the Davies-Meyer format from a specialized block cypher.
Three properties make SHA-256 secure.
First, it is almost impossible to reconstruct the initial data from the hash value. A brute-force attack would need to make 2^256 attempts to generate the initial data.
Second, having two messages with the same hash value (called a collision) is extremely unlikely. With 2^256 possible hash values (more than the number of atoms in the known universe), the likelihood of two being the same is infinitesimally, unimaginably small.
Finally, a minor change to the original data alters the hash value so much that it’s not apparent the new hash value is derived from similar data; this is known as the avalanche effect.
One Way:
The data should be converted to encrypted form but decryption to data should not be possible
Deterministic:
For data, the output should be generated and for that particular input, it should always generate the same output.
That is: if for input “ABC” an output “00DE4” is generated then every time “ABC” is fed the output should be the same “00DE4”
Fast Computation
Computation i.e. encryption, validation etc… must be fast
Withstand Collisions
Hackers must not be able to crack the encrypted data.
Avalanche effect
For even a slight change in input data, there must be a significant change in the output encrypted data.