Hash Functions and Checksums: SHA-1 vs SHA-256 vs SHA-512

What a cryptographic hash does, how the SHA family members differ, and when a hash is (and isn't) the right tool.

5 min readLast updated October 5, 2026

A hash function turns any amount of data into a fixed-size string of characters. The same input always produces the same output, but the output can't be reversed — which makes hashes useful for verifying integrity and detecting change.

The properties that matter

  • Deterministic — the same input always gives the same hash.
  • One-way — you can't recover the input from the hash.
  • Avalanche — changing one character changes the output almost completely.
  • Collision-resistant — it's infeasible to find two different inputs with the same hash.

How the SHA variants differ

SHA-1, SHA-256, SHA-384, and SHA-512 are all from the SHA family and share the same idea; they differ mainly in output size and strength.

  • SHA-1 produces a 160-bit (40 hex) digest and is considered broken for collision resistance — don't use it for security.
  • SHA-256 produces a 256-bit (64 hex) digest and is the sensible default today.
  • SHA-384 and SHA-512 produce longer digests; they're stronger but rarely needed for simple integrity checks.

Checksums in practice

Because a tiny change flips the hash completely, publishing a hash alongside a file lets anyone re-hash what they downloaded and confirm it matches. If even one byte differs, the hash won't match — that's how you detect corruption or tampering.

hash("hello") -> a deterministic 64-char digest
hash("hellO") -> a completely different digest

Same input  = same hash.
Any change  = different hash.

When a hash is the wrong tool

A plain hash is not encryption and not a password store. Because hashes are fast and deterministic, attackers can guess common inputs by hashing candidate after candidate. Passwords should be stored with a slow, salted hash designed for the job (bcrypt, scrypt, or Argon2), not with a single SHA-256.

Try the tools

Related guides