Preserving the integrity of a message from the moment it is sent until it is received has always been a challenge, and it has become a central concern since the advent of computers. Any message may be altered during transmission: by a scratch on a disc, electromagnetic noise in a fiber-optic cable, or a coffee stain on a letter. It is therefore important to detect errors, and even to correct them.
Detecting errors ----------------
A clear distinction should be drawn between error-detecting codes and error-correcting codes. The former are methods for detecting the presence of an error in a code, without necessarily being able to locate it, much less correct it. One example is the check digits at the end of French social security numbers (known as the directory registration number, or NIR). This number consists of thirteen digits and two check digits. The check digits are calculated so that the sum of the thirteen-digit number and the check digits is a multiple of 97, giving the following formula: check digits = 97 – (NIR mod 97), where a mod b denotes the remainder when the integer a is divided by the strictly positive integer b.
The check key is very short—just two digits. Even so, the probability that it will remain valid despite errors in the thirteen-digit number is very low. The method therefore seems effective.
The same principle appears in computing with the parity bit: the first bit (0 or 1) of each byte (a sequence of eight consecutive bits) carries no actual information and serves only to ensure that the byte contains an even number of 1s, making it possible to tell whether a bit in the rest of the byte is wrong.