A cryptographic hash function is a deterministic algorithm h:{0,1}∗→{0,1}n that maps an input of arbitrary length (a byte string) to a fixed-length output called a digest (hash value). Determinism means identical inputs produce identical digests. In blockchain protocols, digest values are treated as commitments: changing any protocol-relevant byte changes the digest.
Cryptographic security is expressed in computational terms. Typical goals are: • Preimage resistance: given y, it is infeasible to find x such that h(x)=y. • Second-preimage resistance: given x, it is infeasible to find x′=x with h(x′)=h(x). • Collision resistance: it is infeasible to find any distinct x,x′ such that h(x)=h(x′). Here, “infeasible” means no known practical algorithm can achieve the task within realistic resource limits.
1) Chain linkage: block headers include a field with the hash of the previous header. If any header byte changes, the new hash no longer matches, so tampering is detected by recomputation. 2) Transaction commitment: many transactions are summarized into a single Merkle root included in the header. A Merkle proof lets a light client verify that a transaction is included in the set committed by that root, without downloading the full block.
| Aspect | Hashing | Encryption |
|---|---|---|
| Primary goal | Integrity / commitment | Confidentiality (plus integrity with AEAD) |
| Reversibility | Designed to be one-way | Reversible with the correct key |
| Key material | Not required for basic hashing | Required for symmetric; pk/sk for asymmetric |