Tech News - An Overview of Cryptography And Hashing In Blockchain
Features of Hashing:
- Any data can be hashed, regardless of its size or type.
- A unique piece of data will always produce the same hash.
- The hash produced for any data is always the same length, irrespective of the scale, type, or length of the data.
- A hash is built to act as a one-way function. You get a unique string when you put data into a hashing algorithm. But when you get a hash, you can’t decode the input data it represents.
- The difference between hash and encryption is that the encryption can be reversed or decrypted using a specific key. Hashing, on the other hand, is a mathematical procedure that is easy to execute but incredibly difficult to reverse.
Test SHA256 Hashing Algorithm
Enter https://emn178.github.io/online-tools/sha256.html in your browser to test how the SHA256 hashing algorithm works.
Enter some text in the upper input box (A). The hash output will be displayed in the lower box (B).
Now, let’s see what happens if I remove the last letter d from the input box. Compare it with the first hash output and observer that there is a huge difference even when just one letter is removed from the input.
Among both the outputs, you will see that both the output values are of the same length, i.e., 64 characters. Each character is of 4 bits. So, the total length is 64 * 4 = 256 bits.
Here are some key points to remember about SHA256.
- All outputs are of the same length
- A small change in the input results in a completely different output
- For the same input, the output will always be the same
- It is not possible to reverse outputs into inputs, which means it is secure.