tooldura

Security & Crypto

SHA-256 Explained: What Hashes Guarantee and What They Do Not

T
tooldura editorial
8 min readUpdated August 5, 2026Open tool →

Change one bit of a file and its SHA-256 hash changes completely, in a way that looks unrelated to the change you made. That property, and two others, is why the same 64-character string appears in download pages, git commits, TLS certificates and blockchains.

Three Properties, One Purpose

A cryptographic hash takes input of any size and produces a fixed-size output, 256 bits for SHA-256, written as 64 hexadecimal characters. The function is deterministic: the same input always produces the same output.

What makes it cryptographic rather than merely a checksum are three properties.

Preimage resistance: given a hash, you cannot work backwards to find an input that produces it. Hashing is one-way, so the output reveals nothing about the input's content or length.

Second preimage resistance: given one input, you cannot find a different input with the same hash. This is what lets a hash stand in for a file.

Collision resistance: you cannot find any two inputs that hash to the same value. This is the strongest requirement and the first to fall when a hash function is broken.

SHA-256 currently holds all three. No collision has ever been produced, and the best known attacks do not meaningfully reduce the work required.

The Avalanche Effect

Hash `hello` and you get `2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824`. Hash `hellp`, one letter different, and you get `9e0d3a8...`, a value with no visible relationship to the first.

This is the avalanche effect: flipping a single input bit should flip roughly half the output bits, unpredictably. It is what makes hashes useful for detecting tampering, because there is no way to make a small, controlled change to the output by making a small change to the input.

It also means a hash cannot tell you *how much* two inputs differ. Two files differing by one byte and two entirely unrelated files both produce completely different hashes. If you need similarity rather than identity, you need a different tool, such as a fuzzy hash or a diff.

The SHA Family in 2026

SHA-1 remains widely deployed in legacy systems despite being broken for collision resistance since 2017.

AlgorithmOutputStatusUse it for
MD5128 bitsBroken since 2004Non-adversarial checksums only
SHA-1160 bitsCollisions demonstrated 2017Legacy compatibility only
SHA-256256 bitsSecureGeneral purpose; the default choice
SHA-384384 bitsSecureHigher margin; common in TLS suites
SHA-512512 bitsSecureFaster than SHA-256 on 64-bit hardware
SHA-3 / Keccak224-512 bitsSecureDifferent internal design; a hedge against SHA-2 breaks
bcrypt / Argon2VariableSecurePasswords, and only passwords
🚫

Do not store passwords with SHA-256

SHA-256 is designed to be fast, and speed is exactly what you do not want when hashing passwords. Commodity hardware computes billions of SHA-256 hashes per second, so a leaked table of hashed passwords falls quickly to a dictionary attack. Password hashing needs a deliberately slow, memory-hard function: Argon2id, scrypt or bcrypt.

Where SHA-256 Earns Its Place

Each of these relies on a different one of the three properties, which is worth noticing when you evaluate whether a hash is the right tool.

1

Verifying downloads

A published hash lets you confirm a file arrived intact and unmodified. This only helps if you get the hash over a channel the attacker does not control, which is why hashes on the same page as the download add less than people think.

2

Content addressing

Git names every object by the hash of its contents, so identical content is stored once and any corruption is detectable. Docker layers and IPFS use the same idea.

3

HMAC and webhook signatures

Combining a hash with a secret key produces a signature that proves both integrity and origin. This is how Stripe, GitHub and most webhook providers let you verify a request really came from them.

4

Deduplication

Backup systems hash blocks to identify duplicates without comparing contents byte by byte. Collision resistance is what makes it safe to treat matching hashes as matching data.

5

Proof of work

Bitcoin mining searches for an input whose SHA-256 hash starts with a run of zeros. Preimage resistance is what makes the search expensive and the verification instant.

Generate a SHA-256 hash

Computed in your browser with the Web Crypto API. Your input is never transmitted.

Open SHA-256 Generator →

What a Hash Cannot Do for You

A hash proves that data has not changed since the hash was computed. It proves nothing about who computed it.

If an attacker can modify the file, they can usually modify the published hash alongside it. This is the flaw in listing a checksum on the same page as the download: anyone who can alter one can alter the other. Checksums are genuinely useful against transmission errors, mirror corruption and a compromised CDN, and genuinely useless against a compromised website. For origin, you need a signature, which is a hash combined with a private key.

The second limit concerns short inputs. Hashing is one-way in the sense that the function cannot be inverted, but if the input space is small, an attacker simply hashes every candidate. Every possible six-digit PIN can be hashed in under a second, so the hash of a PIN, a phone number or an email address provides no meaningful privacy. Adding a secret salt is what makes hashed identifiers resistant to that, and it is why hashed email addresses in advertising datasets are far weaker anonymisation than they appear.

Frequently Asked Questions

Related Tools

Keep Reading