Core Concepts

hash

/ HASH /

A hash is a short, fixed-size fingerprint computed from any piece of data. Feed in a single word or an entire movie, and the hash function spits out the same-length string of characters — a tidy little signature that stands in for the whole thing. The same input always produces the same hash, and even a one-letter change scrambles it completely.

Two properties make it useful. First, it's one-way: you can go from data to hash in an instant, but you can't run it backwards to recover the original — the fingerprint doesn't contain the person. Second, it's a reliable summary: if two files have the same hash, they're almost certainly identical, so you can check a download wasn't corrupted just by comparing fingerprints instead of every byte.

That same trick powers fast lookups. A hash map turns a key like 'email' straight into a number that says exactly which slot to look in — no scanning a list, just compute the hash and go. It's why looking something up by key feels instant even in a giant collection.

$ echo -n "hello" | sha256sum
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
$ echo -n "hellp" | sha256sum   # one letter off — totally different
f3c8cf2...

Same length every time; flip one letter and the whole fingerprint changes.

A git commit ID like 9f2a1c3 is a hash — the fixed-size fingerprint of everything in that snapshot.

Also called
hashinghash functionchecksumdigestsha256md5