hash chain

A sequence of records in which each hash covers the previous hash as well as the new data, so changing any earlier record changes every hash after it.

In more detail

Because each link depends on everything before it, editing one old entry breaks that link and all later ones. Anyone holding a published copy of the latest hash can therefore detect tampering. To hide an edit, a forger would have to recompute every later link and replace every copy others already hold. Git history, tamper-evident audit logs and blockchains all use this idea.

Examples

data = prev + json.dumps(entry, sort_keys=True); prev = hashlib.sha256(data.encode()).hexdigest()
Changing the first of three payments made all three recomputed links report broken

Related terms

Taught in

References