ELI5 · How computers work

Hash functions.

A blender that turns anything into a fixed-size fingerprint.

A hash function takes any input at all — a word, a whole movie file, a password — and crunches it into a short, fixed-size string of characters: its fingerprint.

Two rules make it useful. The same input always produces the same fingerprint. And changing the input even slightly produces a completely different one, with no resemblance to the old.

  1. In it goes.
    a a letter a book a 4 GB video
    1

    Feed in anything at all — a single letter, a whole book, a 4 GB video.

  2. whirr — mix it all
    2

    The hash function is the blender: it mixes and scrambles every byte.

  3. a3f9c1…7b2e always the same length out
    3

    Out comes a short fingerprint, always the same length whatever you put in.

  4. One typo, brand-new print.
    cat a3f9…7b2e car _ d8e2…01ff one letter, nothing alike
    4

    Same input, same fingerprint. Change one letter and it’s utterly different.

  5. hunter2 a3f9… no way back
    5

    It only runs forwards — there’s no un-blend button, which is why passwords are stored this way.

  6. Shelf 7. No searching.
    a3f9… shelf 7 · value jump straight there
    6

    Use the fingerprint as an address and you jump straight to a value — instant lookups.

Drop anything into the blender and the same short fingerprint always comes out — but you can’t un-blend it.

Why one-way matters

You can compute a fingerprint in an instant, but you cannot work backwards from the fingerprint to the original — there is no un-blend button. That is why systems store the hash of your password, not the password itself. When you log in, they hash what you typed and compare fingerprints, so even a stolen database does not hand over your actual password.

It is also how you verify a download was not tampered with: compare the file’s fingerprint to the published one.

Instant lookups

The other big use is speed. A hash table turns a key into a fingerprint and uses it as an address, so it can jump straight to where a value is stored instead of searching. That is what makes dictionaries, sets, and caches feel instant, and it is the same idea behind splitting data across servers by a hashed key.

The real version How hash tables work →
Found this useful?