Every hash digest is a fixed length, but the inputs are unlimited. A SHA-256 fingerprint is 64 hex characters whether it summarises a word or a library. Unlimited inputs squeezed into a fixed number of outputs means collisions must exist in principle: two different inputs produce the same digest. The practical question is whether anyone can find one. For SHA-1, the answer turned out to be yes. For SHA-256, nobody ever has. This guide explains what a collision is, why the birthday effect makes collisions arrive sooner than intuition suggests, and how to see digests yourself with the free SHA Hash Generator on Ovatly.

Contents

  • Quick answer
  • What a collision is, exactly
  • Why the birthday effect matters
  • SHA-1 versus SHA-256: demonstrated versus never found
  • A collision is not password guessing
  • How to compare digests yourself, step by step
  • Worked example: one input, two algorithms
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

A hash collision is two different inputs that produce the same digest. How rare one is depends entirely on the algorithm. SHA-1 collisions have been demonstrated in practice, which is why SHA-1 survives only for verifying old published checksums. No SHA-256 collision has ever been found, and SHA-256 is the right default for new integrity claims. You can generate and compare digests for all four SHA algorithms the tool offers (SHA-1, SHA-256, SHA-384 and SHA-512) in the SHA Hash Generator, entirely on your own device.

What a collision is, exactly

A hash function is deterministic: the same input always gives the same digest. A collision is the reverse accident, two different inputs landing on the same output. Nothing has malfunctioned. The arithmetic guarantees collisions exist, because there are more possible inputs than possible digests, so some digests must be shared. What arithmetic does not tell you is how hard a shared digest is to find.

Two things a collision is not. It is not a way to recover an original input: a digest stays one-way, and finding two inputs that match each other reveals nothing about a third input you care about. And it is not a near miss: a hash has no "close" results, so two digests that differ in one character are simply different digests.

Why the birthday effect matters

Intuition says a collision should take about as many tries as there are possible digests. Intuition is wrong, for the same reason shared birthdays surprise people: in a room, you are not waiting for someone to match your birthday, but for any two people to match each other, and the number of pairs grows far faster than the number of people.

Every new input is compared against every digest already produced, so the chances accumulate by pairs, not by inputs, and the pair count races ahead of the input count. Collisions therefore arrive far sooner than the raw size of the digest space suggests. Digest length still matters: SHA-256's space is so vastly larger than SHA-1's that even with the pair effect working against it, no collision has ever been found, while SHA-1's smaller space let demonstrated collisions happen.

SHA-1 versus SHA-256: demonstrated versus never found

SHA-1 produces a 160-bit digest, shown as 40 hex characters. Its collisions are not theoretical: they have been demonstrated in practice, with two different files produced that share a SHA-1 digest. That ended SHA-1's career as an integrity guarantee. The tool keeps it for one narrow job: verifying an old published checksum issued as SHA-1, where you are matching history rather than making a new claim.

SHA-256 produces a 256-bit digest, shown as 64 hex characters, and its record is the opposite: no collision has ever been found in practice. SHA-512 is fine on 64-bit systems and SHA-384 is common in some standards; both are SHA-2 family. There is no SHA-224 and no SHA3 in the tool, because Web Crypto exposes the SHA-1 and SHA-2 family only.

A collision is not password guessing

These two problems get confused constantly, and the confusion causes bad decisions. A collision hunt is unconstrained: the searcher chooses both inputs freely and wins when any two match each other. Password guessing is the opposite shape: the target is fixed in advance, one specific stored hash for one specific account, and the guesser wins only by finding the input that matches that target.

So a demonstrated SHA-1 collision does not mean hashed passwords are suddenly readable. Collisions threaten situations where an attacker gets to prepare both files, like a forged document pair. Guessing threatens situations where a weak, predictable input was chosen. Different problems, different defences.

How to compare digests yourself, step by step

  1. Open the SHA Hash Generator and choose Text.
  2. Type the three characters abc, select SHA-256 and click Compute. Copy the digest.
  3. Switch to SHA-1 and compute again for the same input. The new digest is completely different and visibly shorter.
  4. Add a trailing newline and compute once more with SHA-256. The digest changes entirely: a different input, not a collision.
  5. For a file with a published checksum, choose File instead, select the publisher's algorithm, and compare digests.

Worked example: one input, two algorithms

Take the entry example, the three characters "abc". With SHA-256, the digest is:

ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

That is the worked example published in FIPS 180-4, the standard defining the SHA-2 family. Run the same "abc" through SHA-1 and you get a different digest, 40 hex characters long instead of 64. Two algorithms, one input, two unrelated outputs: expected, and not a collision. A collision would be two different inputs, under the same algorithm, returning the same string. For SHA-256, despite the whole world being free to try, that has never been observed. For SHA-1, it has been done deliberately. Same test, opposite outcomes.

Limitations and honest tradeoffs

The tool computes one digest at a time; it does not and cannot search for collisions, and it offers no SHA-224 or SHA3, because it uses the browser's audited Web Crypto implementation, which covers the SHA-1 and SHA-2 family. Very large files are read fully into memory, so hashing a huge file can be slow.

"No SHA-256 collision has ever been found" is a statement about the public record, not a proof that none exists: collisions certainly exist, they are simply out of reach. And a collision-free algorithm does not rescue a bad workflow: a digest compared against a reference you cannot trust proves little.

Common mistakes

  • Calling a cross-algorithm difference a collision. SHA-1 and SHA-256 digests of the same file always differ. A collision means same algorithm, different inputs, same digest.
  • Thinking a collision reveals the original input. It does not. The digest remains one-way.
  • Using SHA-1 for a new integrity claim because it is shorter. Its collisions have been demonstrated. New claims belong on SHA-256.
  • Mistaking a changed input for a collision. A trailing newline makes a different input and a different digest. That is the tool working correctly.
  • Assuming no collisions means no risk at all. A digest only proves sameness against a reference, and where the reference came from decides how much that is worth.

FAQs

What is a hash collision in plain terms? It is two different inputs that produce the same digest when hashed with the same algorithm. Because inputs are unlimited and digests are a fixed length, collisions must exist. The practical question is whether anyone can find one, and that depends on the algorithm.

Has a SHA-256 collision ever been found? No. No SHA-256 collision has ever been found in practice. SHA-1 is the opposite case: collisions for SHA-1 have been demonstrated, which is why SHA-1 should only be used to verify old published checksums, never for new integrity claims.

Why does the birthday effect make collisions arrive sooner than expected? Because every new input is compared against all the digests already seen, the number of chances grows with the number of pairs, not the number of inputs. Pairs multiply much faster than items, so collisions turn up far sooner than the total count of possible digests suggests.

Is finding a collision the same as cracking a password? No. A collision hunt chooses both inputs freely and only needs them to match each other. Password guessing has a fixed target: one specific account's stored hash. Matching a specific target is a different and much more constrained problem.

Can the SHA Hash Generator search for a collision? No. The tool computes the digest of one text or file at a time, using SHA-1, SHA-256, SHA-384 or SHA-512, so you can see and compare digests yourself. A search would take an astronomical number of attempts, which is exactly the point for SHA-256.

Conclusion

A collision is two different inputs sharing one digest, and its rarity is a property of the algorithm, not of hashing in general: demonstrated for SHA-1, never found for SHA-256. The SHA Hash Generator lets you produce both kinds of digest on your own device and see the difference yourself. To put fingerprints to work on your own files, read How to Use a SHA Hash to Fingerprint a Document. For more guides in this series, see our Security and Privacy guides.

References