Feed a cryptographic hash function a file, a password or a whole disk image, and it gives back a fixed-length string, like 256 bits for SHA-256. The same input always produces the same output. You can't run it backwards, and you can't practically find two different inputs with the same hash. Those three properties make hashes useful almost everywhere.

Some places you'll meet them in this subject area:

  • Checking downloads. A published SHA-256 sum tells you whether a file was corrupted, though a signature check is stronger because an attacker who swaps the file can swap the checksum on the same page.
  • Onion addresses. The last part of a v3 address includes a checksum computed with SHA3-256, so a typo usually produces an invalid address rather than a different site.
  • Bitcoin. Addresses, block headers and proof-of-work all rely on SHA-256 (and RIPEMD-160 for older address types).
  • Password storage. Sites should store slow, salted hashes (bcrypt, scrypt, Argon2), not the password itself.

MD5 and SHA-1 are broken for collision resistance and shouldn't be trusted for security anymore, even though you'll still see them on old download pages.