A hash is a hexadecimal number that represents a string of data. The process that converts the data into a hash is called hashing.
Hashes are deterministic. In other words, a specific string of data always produces the same hash. So if XYZ is hashed into ecf5b31f02c66b85, for instance, the latter will always be XYZ’s hash.
That said, hashing algorithms are typically designed to be one-way. So, while hashes are deterministic, it’s extremely difficult to convert them back into the original string of data. This ensures they’re secure.
Hashes are also always the same length, regardless of how long — or short — the original string of data was. The hash’s length depends on which hashing algorithm is used. Bitcoin, for instance, uses the SHA-256 hashing algorithm, so hashes are always 256 bits — 64 characters — long.
In the crypto space, hashes have a number of important functions:
- They’re proof of work. The solutions to the mathematical puzzles that miners must solve to earn new coins and verify transactions are hashes.
- They link blocks together. Each verified block on a blockchain has a ‘hash pointer’ which identifies the previous block’s address and the data it holds. This is how the blocks on the blockchain are ‘chained’ together.
- They make the blockchain immutable. Because every valid block on the chain contains a hash of the previous block, any attempts to change one block will affect every other block on the chain. Changing every single block requires so much computing power that it’s not technically feasible.
The word “hash” comes from the French “hacher”, which means to chop into small pieces. This is an apt description of what hashing does: it chops up a large string of data so it’s smaller and more manageable but still identifiable.
Whitfield Diffie and Martin Hellman identified the need for one-way hashing in public key cryptography in an academic paper published in 1976.
But the first practical application came in 1993, when Cynthia Dwork and Moni Naor invented a hash-based proof of work system that could be used to prevent denial of service attacks and other online abuses, including email spam.
Dwork and Naor didn’t call their system ‘proof of work’, though. Credit for this goes to Markus Jakobsson and Ari Juels, who coined the term in a 1999 paper.
Many commentators argue that, while quantum computers do present risks to the blockchain, hashing algorithms should be safe. This is because they’re relatively unstructured. So, while quantum computers are far faster and more powerful than traditional machines, they’d still have to try and break a hash the same way a traditional machine would: through a brute force attack (a type of attack in which the machine keeps submitting different combinations until it guesses the right one).
That said, Brandon Rodenburg and Stephen P. Pappas are less optimistic. In a 2017 technical report, they theorised that when a quantum computer attacks a hash, the hash would only be half as secure as it would be while under attack by a traditional device.
Want to know more?
Diffie and Hellman’s paper, written at a time when cryptography was still in its infancy, is remarkably forward-looking, but it also highlights quite starkly the technological limitations of the time.
Rodenburg and Pappas‘ report has an excellent explanation of hashing algorithms and how quantum computing could put their security at risk.
“Hashes are at the core of crypto. They preserve data integrity and keep blockchains secure. So while it remains to be seen whether quantum computers will be able to crack hashes, more powerful hashing algorithms are a good thing, because they’ll strengthen the blockchain, which ultimately benefits everyone.”