Blockchain 101

Hash Functions

Hashing is the process of creating an irreversible “digest” of a message. The hash function takes an input of any length (a message, for example), and returns a fixed-length string of seemingly random numbers and letters, which is called the hash value (also known as a message digest, digital fingerprint, or digest).

This means that a person who knows the hash value cannot feasibly recover the original message, but the person who knows the original message can prove that the hash value is created from that message very quickly. When digests are equal, it confirms that the message has not been modified or changed.  The security in this process depends on the quality of the hash algorithm, and that it is so computationally difficult to alter or substitute a message that generates the same digest.

The output (the digest or the hash) is a fixed length hash independent of the input’s length. A short sentence would return the same hash as the entire dictionary. Altering one character of the message data will result in a completely new hash being outputted.

Hash Function

Hashing algorithms are used as a tool in digital cryptography, taking inputs of any length and returning an alphanumeric code of a fixed length, obfuscating the data from which the hash is derived. Any attempt to change the data in the block would result in greatly different hash output. Hashes cannot be feasibly decoded, but they can be easily verified, which plays a big role in verifying data on a decentralized network, which helps enable consensus.

There are many hashing algorithms available, some stronger than others. Using a strong hashing algorithm can also protect against brute force attacks; even from the most advanced computers cannot reliably test every possible message that would result in the same hash being produced.

Most of the data in a block is hashed and hashed again. It may be confusing to keep track of all this hashed data, but structures known as Merkle Trees make for efficient referencing of hashing.