Hash
Resultado de tamanho fixo produzido por uma função que transforma qualquer dado em um código único, usado para verificar integridade na blockchain.
Key points
- A hash is the fixed-size output produced by a function that transforms any input data into an apparently random code.
- The same input always generates the same hash, but any minimal change to the input completely changes the result.
- It is the cryptographic building block that chains blocks together and allows quick verification of whether data has been altered.
What is a hash?
A hash is the output of a hash function, an algorithm that takes any amount of data and returns a fixed-length code. This code works like a fingerprint of the original data: it identifies it compactly, and it is practically impossible to find two different inputs that produce the same result. It is one of the central tools of modern cryptography.
How it works
A good hash function has useful properties. It is deterministic, meaning the same input always generates the same output. It is sensitive: changing a single character in the input completely alters the result, with no resemblance to the previous one. And it is one-way: from the hash, there is no practical path to reconstruct the original input.
On the blockchain, each block contains the hash of the previous block, creating the chain that gives the technology its name. Altering an old piece of data would change its hash and, in cascade, the hash of all subsequent blocks, making fraud evident. In proof-of-work networks, miners repeatedly search for a hash that meets a target, and it is this effort that secures the network.
Verifying a hash is fast and cheap, even though producing one with certain properties can be costly, and this asymmetry is what makes the mechanism useful.
Why it matters
Hash is what allows trust in data integrity without needing to compare entire datasets. For a company, this means being able to prove that a record has not been altered just by checking its hash, and it is this property that underpins the immutability and auditability of a blockchain.
Limitations
Security depends on the hash function used remaining resistant: flaws discovered in older algorithms have already made them insecure over time. A hash proves that data has not changed, but says nothing about the truthfulness of the content itself. And because it is one-way, data whose original has been lost cannot be recovered from the hash. Choosing modern, well-established hash functions is therefore an important security decision.