bitrotlab

The parity bench · 20 October 2026

How parity gets lost pieces of a file back

The parity bench rebuilds missing strips of a picture from a few extra ones. It looks like magic, but the idea fits on the back of a receipt. Here it is without the maths.

When a file goes bad on a disk, the usual answer is "restore it from a backup". That works if the backup still holds a good copy. Often it doesn't: the damage happened months ago, nobody noticed, and every backup since has faithfully copied the damaged file. What then?

There's another way to get a file back, one that doesn't need a copy at all: keep a little extra data next to it, calculated from the file itself, that can rebuild the parts that go missing. That extra data is called parity, and it's what the parity bench shows step by step.

1. A total is a clue

Take four numbers: 3, 5, 2 and 7. Before anything goes wrong, write down their total: 17.

Now lose one of them. Say the 5 disappears and you're left with 3, ?, 2 and 7. You don't need a copy of the 5 to get it back. The total says the four add up to 17, the three you still have add up to 12, so the missing one must be 5.

That's the whole idea. The total isn't a copy of any number; it's a fact about all of them together. And because it involves all of them, it can stand in for whichever one goes missing.

2. More clues, more lost pieces

One total can only bring back one missing number. Lose two, say the 5 and the 7, and all the total tells you is that they add up to 12. That could be 5 and 7, but also 6 and 6, or 10 and 2.

So you keep more than one clue, each worked out in a different way. A second total might count each number with a different weight: the first once, the second twice, the third three times, and so on. Now you have two facts about two unknowns, and there's only one pair of numbers that fits both. Keep three such clues and you can rebuild any three missing numbers, whichever three they are.

The rule is simple: you can get back as many missing pieces as you have clues. Lose one more than that and the clues no longer pin the answer down.

3. From numbers to a picture

A file is just a long row of numbers (bytes), so the same trick works on it. On the parity bench, a picture is cut into eight strips, A to H. From those eight, the bench makes three recovery strips. Each one is a different weighted "total" of all eight strips, worked out for every byte.

That's why the bench says the recovery strips are "mixes, not copies". Recovery strip 1 isn't strip A; it holds a little bit of every strip at once. When up to three of the eight strips go missing, the bench uses the strips that are left and the three recovery strips to work out what the missing ones must have been, byte by byte, until the picture is whole again.

The real arithmetic is a little different from the school kind. It uses a special number system where adding and multiplying never make numbers bigger than they started, so a recovery strip is exactly the same size as a picture strip. The idea is the same as the total of 17. If you want to see every step on a tiny file, the bench has an under the hood page that shows all the numbers.

4. Finding the damage: fingerprints

There's a catch. Recovery strips can rebuild a strip that's missing, but real damage doesn't announce itself. A strip with a few flipped bits doesn't look missing; it just looks slightly wrong, or not wrong at all.

So the bench records a second thing for each strip: a fingerprint (a checksum), a short code worked out from the strip's contents. Change even one byte of the strip and its fingerprint changes completely. Before repairing, the bench checks each strip against its fingerprint. A strip that no longer matches is treated as missing, and the recovery strips rebuild it.

Fingerprints find the damage. Recovery strips fix it.

Both are needed. Fingerprints alone tell you which part is broken but can't fix it. Recovery strips alone could fix it, but wouldn't know which part to fix.

5. What it costs, and where you'll meet it

On the bench, three recovery strips protect eight picture strips, which is a lot of extra space, chosen so the repair is easy to watch. Real recovery files usually add 5 to 10% to the size of what they protect. That's enough to repair the scattered, small damage that silent corruption usually causes.

You've probably met the idea already without knowing it:

6. What parity can't do

See it happen The parity bench Cut a picture into strips, make recovery strips, lose or scramble some of the originals, and watch them come back. Use a built-in photo or one of your own; it never leaves your browser. Watch a repair →

Doing this by hand for every file you own isn't practical, which is why tools exist that keep recovery data for you and check files against their fingerprints on a schedule. FileGriffon, from the makers of this lab, is one of them.