What is a Hash?
A hash is a fixed-length unique digital fingerprint generated from data using a specific algorithm.
On this page
Hash: The Digital Summary of Data
A hash is a digital summary obtained by processing data through a specific computational method. The input can be a word, a file, or a blockchain block. Depending on the method used, the result is of a fixed length. For example, SHA-256 produces a 256-bit output for both a short text and a large file.
When the same data is processed using the same method, it produces the same hash. If even a single character in the data changes, the result typically appears completely different. This property allows for a quick comparison to determine if two pieces of data are identical. You can compare a verification hash published alongside a file with the hash of the file you downloaded. A match is strong evidence that the file is the same as the data used to generate that hash; however, it does not prove the file is safe on its own.
Why Is It Used in Blockchain?
Blocks can reference the hash of the previous block. If a record in an older block is modified, the hash of that block changes, and subsequent links become inconsistent. This makes attempts to alter the history detectable. Whether this results in determining which chain is considered valid depends on the network’s consensus rules.
Bitcoin miners repeatedly hash the block header to find a result that falls below a specified target. While finding a suitable result requires trial and error, verifying the found result is much easier. This disparity lies at the core of the computational race in mining.
Hashing Is Not Encryption
In encryption, the original data can be recovered using the correct key. Hashing, however, is not designed to be reversed. Nonetheless, the same hash can be found by testing short and predictable inputs. Therefore, it is incorrect to say “hashed information is confidential under all circumstances.” Additionally, it is mathematically possible for different inputs to produce the same result; in secure methods, finding such a match intentionally is expected to be extremely difficult.