Evaluation
What was measured, on which pictures and texts, and what the numbers do not show. One run, on 2 December 2026.
The run
- Crate
- legit-hashes 0.2.0, built in release mode with Rust 1.100.1
- Date
- 2 December 2026. Rows marked * are from the run of 1 December, on version 0.1.0.
- Pictures
- 335 at about 1.5 megapixels and 20 at full size: artworks from the Cleveland Museum of Art's Open Access collection (CC0) and photographs from NASA's image library
- Changed copies
- 7,370: each of the 335 pictures changed 22 ways with Pillow
- Different pictures
- 55,899 pairs, every pairing of two of the 335
- Texts
- 187 passages from 23 Project Gutenberg books in six languages, and 2,214 edited copies of them
- Compared with
- Python ImageHash 4.3.2, Meta's PDQ reference in C++, blockhash-python, datasketch 2.0.0
The numbers behind every table and drawing on this page are in one file. The program that produced them is not public yet.
What this does not show
- How the hashes behave on your pictures. These are museum objects, paintings, old prints and NASA photographs. Screenshots, drawings, scans of documents or product shots can behave differently.
- Anything about a person trying to defeat the hash. Every change here is an ordinary one.
- Fine differences. With 6,030 same-picture pairs and 55,899 different ones, nothing on this page is known more finely than about one pair in a thousand for misses, or one in ten thousand for false matches.
- A threshold for you to copy. The cuts below are where these pictures separate best. Measure your own on pictures you have labelled.
Does it compute what it says?
Each definition names an implementation it must agree with, bit for bit, when both are given the same pixels or the same text.
| Definition | Must equal | Inputs | Differences |
|---|---|---|---|
average-v1 * | ImageHash average_hash | 8,082 pictures | 0 |
difference-v1 * | ImageHash dhash | the same | 0 |
perceptual-v1 * | ImageHash phash | the same | 0 |
simhash-v1 * | a second implementation, written from the definition | 337 texts | 0 |
pdq-v1 | Meta's C++ reference, hash and quality score | 1,065: 355 pictures at three sizes | 0 |
blockhash-v1 | blockhash-python | the same 1,065 | 0 |
minhash-v1 | datasketch 2.0.0, its default | 4,802 texts, all 128 values of each | 0 |
minhash-legacy-v1 | datasketch 2.0.0, scheme="legacy" | the same 4,802 | 0 |
pdq-v1 has a second way of computing, in whole numbers, for processors without standard floating point. On 710 of those inputs it gave the same bits as the first: 0 differences.
From whole files the picture changes a little, because each library opens and shrinks a file its own way. Against ImageHash's own phash of the same files, perceptual-v1 was identical on about two files in three and never more than 8 bits away. So hashes stored by another library are close to this crate's, and not interchangeable with them.
How far does a changed copy move?
Each of the 335 pictures was changed 22 ways, and each copy's hash compared with the original's. A dot is the middle copy. The heavy line reaches the point 19 copies in 20 stay within, and the thin line reaches the worst copy.
perceptual-v1, of 64 bits
pdq-v1, of 256 bits
blockhash-v1, of 256 bits
| Change | average-v1 * |
difference-v1 * |
perceptual-v1 |
pdq-v1 |
blockhash-v1 |
|---|---|---|---|---|---|
| JPEG, quality 95 | 0 / 0 / 1 | 0 / 1 / 2 | 0 / 0 / 2 | 0 / 2 / 2 | 0 / 2 / 6 |
| JPEG, quality 75 | 0 / 0 / 2 | 0 / 1 / 4 | 0 / 0 / 2 | 0 / 2 / 6 | 0 / 2 / 8 |
| JPEG, quality 50 | 0 / 1 / 6 | 0 / 3 / 11 | 0 / 2 / 4 | 0 / 4 / 8 | 0 / 6 / 40 |
| JPEG, quality 30 | 0 / 1 / 3 | 0 / 3 / 8 | 0 / 2 / 4 | 2 / 4 / 12 | 2 / 7 / 28 |
| Twice the size | 0 / 0 / 2 | 0 / 1 / 2 | 0 / 0 / 2 | 2 / 10 / 18 | 0 / 2 / 2 |
| Half the size | 0 / 0 / 3 | 0 / 1 / 3 | 0 / 2 / 2 | 6 / 14 / 36 | 0 / 2 / 8 |
| A quarter the size | 0 / 1 / 3 | 0 / 1 / 4 | 0 / 2 / 2 | 12 / 30 / 48 | 0 / 2 / 8 |
| Brighter | 0 / 2 / 4 | 1 / 4 / 7 | 0 / 2 / 6 | 0 / 6 / 16 | 0 / 4 / 16 |
| Darker | 0 / 2 / 5 | 1 / 4 / 8 | 0 / 2 / 2 | 0 / 2 / 6 | 0 / 2 / 24 |
| More contrast | 0 / 2 / 5 | 1 / 3 / 6 | 0 / 2 / 2 | 0 / 4 / 10 | 0 / 2 / 24 |
| Less contrast | 0 / 2 / 5 | 1 / 4 / 7 | 0 / 2 / 2 | 0 / 2 / 6 | 0 / 2 / 29 |
| Gamma 0.8 | 1 / 3 / 7 | 1 / 4 / 9 | 2 / 4 / 8 | 4 / 10 / 18 | 2 / 6 / 12 |
| Gamma 1.2 | 1 / 3 / 5 | 1 / 4 / 10 | 2 / 4 / 4 | 4 / 10 / 14 | 2 / 6 / 26 |
| Blur, radius 1 | 0 / 2 / 6 | 1 / 3 / 4 | 0 / 2 / 4 | 0 / 2 / 4 | 0 / 2 / 6 |
| Blur, radius 2 | 0 / 1 / 3 | 0 / 1 / 4 | 0 / 2 / 2 | 2 / 6 / 10 | 0 / 2 / 6 |
| Words across it | 1 / 5 / 18 | 1 / 3 / 6 | 2 / 6 / 12 | 10 / 30 / 62 | 8 / 24 / 60 |
| 2% cropped | 2 / 7 / 23 | 5 / 9 / 21 | 4 / 10 / 18 | 38 / 54 / 72 | 18 / 40 / 76 |
| 5% cropped | 6 / 14 / 26 | 11 / 18 / 27 | 10 / 18 / 28 | 82 / 112 / 146 | 42 / 78 / 104 |
| 5% border | 16 / 37 / 55 | 13 / 22 / 34 | 14 / 20 / 26 | 84 / 110 / 140 | 66 / 110 / 146 |
| Turned 1° | 1 / 6 / 11 | 3 / 10 / 14 | 4 / 10 / 18 | 24 / 46 / 72 | 14 / 30 / 67 |
| Turned 3° | 4 / 12 / 27 | 8 / 16 / 24 | 10 / 18 / 26 | 56 / 84 / 132 | 32 / 52 / 76 |
| Mirrored | 16 / 38 / 54 | 27 / 39 / 49 | 32 / 34 / 38 | 128 / 134 / 138 | 108 / 164 / 200 |
The first three are of 64 bits and the last two of 256. Saving again and resizing are JPEG and Lanczos; a turned copy keeps its size and gets black corners; the border is black and 5% of each side; the words are white at half strength across the middle.
The same picture, or a different one?
Take every copy whose change keeps the picture's shape within about 2% (6,030 pairs: saving again, resizing, tone, blur, the stamped words, the 2% crop and the 1° turn) and every pair of different pictures (55,899). A cut says "the same" at or under some number of bits. The table gives, for each definition, the cut that got the fewest wrong.
| Definition | Bits | Best cut | Copies missed, of 6,030 | Different pictures matched, of 55,899 | Closest different pair | 1 in 100 different pairs within | Middle different pair |
|---|---|---|---|---|---|---|---|
average-v1 * | 64 | 7 | 30 | 186 | 0 | 11 | 32 |
difference-v1 * | 64 | 12 | 5 | 22 | 9 | 19 | 31 |
perceptual-v1 | 64 | 14 | 4 | 5 | 10 | 22 | 32 |
pdq-v1 | 256 | 72 | 0 | 2 | 66 | 108 | 128 |
blockhash-v1 | 256 | 50 | 8 | 66 | 24 | 76 | 128 |
Meta suggests starting pdq-v1 at 31 bits. On these pictures that cut missed 357 of the 6,030 copies (5.9%) and matched none of the 55,899 different pairs. Seeing none in that many puts the true rate under about one in 18,633, and no lower. The closest two different pictures were 66 bits apart.
Size matters to PDQ
pdq-v1 reads fine detail, so a much smaller copy is further from its original than any other ordinary change makes it. These are the quarter-size copies from above, split by how small they ended up:
| Copy's longer side | Pairs | Middle | 19 in 20 within | Worst |
|---|---|---|---|---|
| 384 pixels or more | 175 | 8 | 14 | 18 |
| 256 to 383 pixels | 28 | 13 | 22 | 24 |
| Under 256 pixels | 132 | 20 | 34 | 48 |
On those same pairs perceptual-v1 moved at most 2 of its 64 bits. Shrinking a picture to 512 pixels before pdq-v1, as Meta's paper suggests for speed, moved the hash by a middle 10 bits (19 in 20 within 18, worst 34).
What does work is one size for everything. When two copies of different sizes were both reduced to 500 pixels first, their pdq-v1 hashes were a middle 2 bits apart at worst, 19 in 20 within 8, never more than 16, and no pair passed 31. So hash one size of every picture, and never compare a hash of an original with a hash of a reduced copy.
Text
minhash-v1 estimates how much of two texts' five-character runs are shared. Over 2,214 edited copies its estimate was off by +0.0002 on average, with a spread of 0.025; the worst was +0.13. Over 5,553 unrelated pairs it was off by +0.0006, spread 0.006. The spread theory allows is at most 0.044.
Telling a lightly edited copy from an unrelated passage, minhash-v1 made no mistake at any length of text in this set. simhash-v1 on five-character runs was close behind on long texts; on texts under 150 characters it missed 1.6% of copies and matched 1.0% of unrelated passages at its best cut. The best cut for minhash-v1 rose with length, from 0.17 for texts under 50 words to 0.55 for texts over 300, so a cut has to be chosen for the length of text you have.
Neither changes a character before hashing. Lower-casing and collapsing spaces first lifted an all-capitals copy from almost no measured overlap to a full match.
Limits the run found
- A mirrored copy, a crop of more than a few percent, an added border or a turn of more than about a degree is far from its original under every image hash here. The drawings above show how far.
- A flat or symmetric picture gives
pdq-v1bits that mean nothing, with a low quality score. The score is there to discard them. - A JPEG cut off half way still opens, its missing half filled in, and hashes without an error.
- A photo's stored orientation is not applied, and only
blockhash-v1sees transparency. - PNG and JPEG files only. GIF and WebP are refused.
The square beside the crate's name is simhash-v1:9e358cd3b5724a85, the hash of this page's opening sentence, computed by the crate as the page was served. Each page here has its own.