What is hash matching?
Definition
Hash matching is comparing a short fingerprint of a file against a list of fingerprints of files already known to be bad, such as known malware. It finds exact or near copies without anyone needing to look at the file.
Also called: Hash lookup, File fingerprinting, Perceptual hashing, Hash list matching
What is a hash?
A hash is a short fingerprint calculated from a file's contents. A hash function reads every byte and outputs a fixed-length string, such as the 64 hexadecimal characters of SHA-256, whatever the file's size. The same file always gives the same hash, and two different files practically never do.
A hash works in one direction only. You cannot rebuild the file from its hash, which is how a fingerprint can be looked up without sharing the file. That also sets it apart from encryption, such as encryption at rest, which hides a file in a way the right key can reverse.
How does hash matching work?
Hash matching works by computing the hash of a new file and checking it against a list of hashes of files already confirmed as bad. If the hash is on the list, the file is a copy of something known, and the host can block it at once.
Organizations build and share these lists. Security groups keep lists of known malware, and child-protection organizations keep lists of confirmed child sexual abuse material, so hosts can find copies without anyone having to view the material again.
What is the difference between exact and perceptual hashes?
An exact hash, also called a cryptographic hash, matches only a byte-for-byte identical file. It suits malware, where the file itself is the threat. A perceptual hash is built from what an image looks like instead, so it also matches copies that were resized or saved again in another format.
Hosts use both. Exact hashes answer "have we seen this exact file?" quickly and privately. Perceptual hashes catch the near copies that appear once an image has been shared around.
What can hash matching not do?
Hash matching only finds files that are already on a list. Brand-new malware, or material that has never been reported, has no fingerprint yet, so it passes this check. That is why hosts pair it with other content moderation checks, such as a magic-byte file-type check, AI classifiers, human review and reports.
| Kind | Matches | Typical use |
|---|---|---|
| Exact (such as SHA-256) | Identical files only | Known malware, duplicate files |
| Perceptual | Images that look the same, even resized | Known illegal images |
| Checksum (such as CRC32) | Identical files, with no protection against tampering | Checking a download arrived intact |
Hash matching: common questions
Does hash matching mean someone looks at my files?
No. A machine compares fingerprints with a list. People get involved only when there is a match, a flag from another check, or a report.
Can two different files have the same hash?
In theory, yes. With a modern hash such as SHA-256 it is so unlikely that it is treated as impossible in practice, while older ones such as MD5 are too weak to rely on for security.
Can someone rebuild my file from its hash?
No. A hash is one-way and far too short to hold the file. It can only tell you whether two files are the same.
What happens when an upload matches a known-abuse list?
On Link in Seconds the material is removed, the account is permanently banned, the material and records are preserved for investigators, and the matter is reported to the authorities.
Is hash matching used for anything besides safety?
Yes. Hashes confirm a download arrived intact, spot duplicate files in storage, and let backup tools copy only what changed.
Related terms
- Content moderationContent moderation is the set of checks a host runs to keep illegal or harmful files off its service: automated scanning at upload, human review of anything flagged, and a way for anyone to report a link.
- Magic bytesMagic bytes are the first few bytes of a file, which reveal its real format whatever its name says. A PDF starts with %PDF, for example, so checking them catches a program renamed to look like a document.
- Encryption at restEncryption at rest means stored data is kept encrypted on the disks where it sits, so a stolen or discarded disk is unreadable. The service holds the keys and decrypts files when you open them, so it protects against outsiders, not the service.
- End-to-end encryptionEnd-to-end encryption means a file is encrypted on the sender's device and can only be decrypted on the recipient's device. The service in the middle carries the data but never holds the key, so it cannot read the contents.
- File hostingFile hosting is keeping a file online at a stable address so people can open it whenever they like, often in the browser. It suits files you share again and again: a resume, a menu, a price list.
Go deeper
Updated