What Is a Hash Function?

A hash function takes any input — a word, a file, a gigabyte of data — and produces a fixed-size string called a hash or digest. It's one of the most useful tools in computing.

A simple example

The SHA-256 hash of hello is always:

2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824

Same input → same output, every time. Change one letter and the hash changes completely.

Key properties of a good (cryptographic) hash

  • Deterministic — the same input always gives the same hash.
  • Fixed size — SHA-256 is always 64 hex characters, regardless of input size.
  • One-way — you can't reverse a hash back to the input.
  • Avalanche effect — a tiny input change produces a totally different hash.
  • Collision-resistant — it's infeasible to find two inputs with the same hash.

What hashes are used for

  • Integrity checks — verify a download wasn't corrupted or tampered with.
  • Password storage — store the hash, never the password (with salting + a slow hash like bcrypt).
  • Deduplication and caching — use the hash as a content fingerprint.
  • Digital signatures and blockchains.

Hashing is not encryption

Encryption is reversible with a key; hashing is one-way by design. You can't "decrypt" a hash. See MD5 vs SHA-256 for algorithm differences.

Try it

Generate MD5, SHA-1, and SHA-256 hashes of any text with the hash generator.

Got a config file to check?

Open the config toolkit →