How is it possible that WinRAR can repair any volume with one .rev file?
Lets take a really simple case.
You have four volumes and a recovery volume, each with 1 bit of information in it:
========================================================
Volumes: = Volume 1 = Volume 2 = Volume 3 = Volume 4 = Recovery =
=----------=----------=----------=----------=----------=
Bits: = 1 = 0 = 1 = 1 = 1 =
========================================================
The recovery volume would contain the result of each of these bits XORd together:
1 XOR 0 XOR 1 XOR 1 = 1
So, our recovery volume contains the single bit 1
.
Now, lets say volume 1 fails.
If we XOR the remaining volumes 2, 3 and 4 with the recovery bit in place of the failed volume we get:
1 XOR 0 XOR 1 XOR 1 = 1
^
So, this tells us that volume 1 contained 1
, since it is the result of the equation.
Let us pretend volume 2 died instead, so we replace it's value in the equation with the recovery bit:
1 XOR 1 XOR 1 XOR 1 = 0
^
So we know that volume 2 contained 0
, since it is the result of the equation.
If volume 3 or 4 failed, they would both produce 1
in this equation.
So, if any of the volumes failed, the recovery volume can be used to reconstruct the data based on the remaining volumes. This is probably the simplest form of error correction you can have. If two volumes failed, you can't recover anything.
For a really simple way to understand how this could be, imagine if the recovery volume contained the sum of the other volumes. With a list of numbers, missing one of them, and their sum, you can always reconstruct the missing number.
For example, consider these two digit numbers, 13, 88, 17, 43. If you knew that there was one missing number and the last two digits of the sum of all the numbers was 81, you could find the missing number. 13 + 88 + 17 + 43 = 161. The only two-digit number you can add to that to make a number that ends in 81 is 20.
Say you had the 20 and were missing the 43. 13 + 88 + 17 + 20 = 138. The only two-digit number you can add to that to make a number that ends in 81 is 43.
Thus the recovery number lets you find any one missing number.