In information theory and coding theory with applications in computer science and telecommunication, error detection and correction or error control are techniques that enable reliable delivery of digital data over unreliable communication channels. Many communication channels are subject to channel noise, and thus errors may be introduced during transmission from the source to a receiver. Error detection techniques allow detecting such errors, while error correction enables reconstruction of the original data.
The general definitions of the terms are as follows:
Error correction may generally be realized in two different ways:
ARQ and FEC may be combined, such that minor errors are corrected without retransmission, and major errors are corrected via a request for retransmission: this is called hybrid automatic repeatrequest (HARQ).
Contents 
Several schemes exist to achieve error detection. The general idea is to add some redundancy (i.e., some extra data) to a message, which enables detection of any errors in the delivered message. Most such errordetection schemes are systematic: The transmitter sends the original data bits, and attaches a fixed number of check bits, which are derived from the data bits by some deterministic algorithm. The receiver applies the same algorithm to the received data bits and compares its output to the received check bits; if the values do not match, an error has occurred at some point during the transmission. In a system that uses a "nonsystematic" code, such as some raptor codes, the original message is transformed into an encoded message that has at least as many bits as the original message.
In general, any hash function may be used to compute the redundancy. However, some functions are of particularly widespread use because of either their simplicity or their suitability for detecting certain kinds of errors (e.g., the cyclic redundancy check's performance in detecting burst errors).
Errorcorrecting codes can provide a suitable alternative to hash functions when a strict guarantee on the minimum number of errors to be detected is desired. Repetition codes, described below, are special cases of errorcorrecting codes: although rather inefficient, they find applications for both error correction and detection due to their simplicity.
A repetition code is a coding scheme that repeats the bits across a channel to achieve errorfree communication. Given a stream of data to be transmitted, the data is divided into blocks of bits. Each block is transmitted some predetermined number of times. For example, to send the bit pattern "1011", the fourbit block can be repeated three times, thus producing "1011 1011 1011". However, if this twelvebit pattern was received as "1010 1011 1011" – where the first block is unlike the other two – it can be determined that an error has occurred.
Repetition codes are not very efficient, and can be susceptible to problems if the error occurs in exactly the same place for each group (e.g., "1010 1010 1010" in the previous example would be detected as correct). The advantage of repetition codes is that it they are extremely simple, and are in fact used in some transmissions of numbers stations.^{[citation needed]}
A parity bit is a bit that is added to ensure that the number of set bits (i.e., bits with the value 1) in a group of bits is even or odd. A parity bit can only detect an odd number of errors (i.e., one, three, five, etc. bits that are incorrect).
There are two variants of parity bits: even parity bit and odd parity bit. When using even parity, the parity bit is set to 1 if the number of ones in a given set of bits (not including the parity bit) is odd, making the entire set of bits (including the parity bit) even. When using odd parity, the parity bit is set to 1 if the number of ones in a given set of bits (not including the parity bit) is even, making the entire set of bits (including the parity bit) odd. In other words, an even parity bit will be set if the number of set bits plus one is even, and an odd parity bit will be set if the number of set bits plus one is odd.
There is a limitation to parity schemes. A parity bit is only guaranteed to detect an odd number of bit errors. If an even number of bits (i.e., two, four, six, etc.) are flipped, the parity bit will appear to be correct even though the data is erroneous. Extensions and variations on the parity bit mechanism are horizontal redundancy checks, vertical redundancy checks, and "double," "dual," or "diagonal" parity (used in RAIDDP).
A checksum of a message is a modular arithmetic sum of message code words of a fixed word length (e.g., byte values). The sum may be negated by means of a one'scomplement prior to transmission to detect errors resulting in allzero messages.
Checksum schemes include parity bits, check digits, and longitudinal redundancy checks. Some checksum schemes, such as the Luhn algorithm and the Verhoeff algorithm, are specifically designed to detect errors commonly introduced by humans in writing down or remembering identification numbers.
A cyclic redundancy check (CRC) is a cyclic code and nonsecure hash function designed to detect accidental changes to raw computer data. Its computation resembles a polynomial long division by a socalled generator polynomial in which the quotient is discarded and the remainder becomes the result, with the important distinction that the polynomial coefficients are calculated according to the carryless arithmetic of a finite field.
Cyclic codes have favorable properties in that they are well suited for detecting burst errors. CRCs are particularly easy to implement in hardware, and are therefore commonly used in digital networks and storage devices such as hard disk drives.
Even parity is a special case of a cyclic redundancy check, where the singlebit CRC is generated by the divisor x+1.
A cryptographic hash function can provide strong assurances about data integrity, provided that changes of the data are only accidental (i.e., due to transmission errors). Any modification to the data will likely be detected through a mismatching hash value. Furthermore, given some hash value, it is infeasible to find some input data (other than the one given) that will yield the same hash value. Message authentication codes, also called keyed cryptographic hash functions, provide additional protection against intentional modification by an attacker.
Any errorcorrecting code can be used for error detection. A code with minimum Hamming distance, d, can detect up to d1 errors in a code word. Using errorcorrecting codes for error detection can be suitable if a strict limit on the minimum number of errors to be detected is desired.
Codes with minimum Hamming distance d=2 are degenerate cases of errorcorrecting codes, and can be used to detect single errors. The parity bit is an example of a singleerrordetecting code.
The Berger code is an early example of a unidirectional error(correcting) code that can detect any number of errors on an asymmetric channel, provided that only transitions of cleared bits to set bits or set bits to cleared bits can occur.
Automatic Repeat reQuest (ARQ) is an error control method for data transmission that makes use of errordetection codes, acknowledgment and/or negative acknowledgment messages, and timeouts to achieve reliable data transmission. An acknowledgment is a message sent by the receiver to indicate that it has correctly received a data frame.
Usually, when the transmitter does not receive the acknowledgment before the timeout occurs (i.e., within a reasonable amount of time after sending the data frame), it retransmits the frame until it is either correctly received or the error persists beyond a predetermined number of retransmissions.
Three types of ARQ protocols are Stopandwait ARQ, GoBackN ARQ, and Selective Repeat ARQ.
ARQ is appropriate if the communication channel has varying or unknown capacity, such as is the case on the Internet. However, ARQ requires the availability of a back channel, results in possibly increased latency due to retransmissions, and requires the maintenance of buffers and timers for retransmissions, which in the case of network congestion can put a strain on the server and overall network capacity.^{[2]}
An errorcorrecting code (ECC) or forward error correction (FEC) code is a system of adding redundant data, or parity data, to a message, such that it can be recovered by a receiver even when a number of errors (up to the capability of the code being used) were introduced, either during the process of transmission, or on storage. Since the receiver does not have to ask the sender for retransmission of the data, a backchannel is not required in forward error correction, and it is therefore suitable for simplex communication such as broadcasting. Errorcorrecting codes are frequently used in lowerlayer communication, as well as for reliable storage in media such as CDs, DVDs, and dynamic RAM.
Errorcorrecting codes are usually distinguished between convolutional codes and block codes:
Shannon's theorem is an important theorem in forward error correction, and describes the maximum information rate at which reliable communication is possible over a channel that has a certain error probability or signaltonoise ratio (SNR). This strict upper limit is expressed in terms of the channel capacity. More specifically, the theorem says that there exist codes such that with increasing encoding length the probability of error on a discrete memoryless channel can be made arbitrarily small, provided that the code rate is smaller than the channel capacity. The code rate is defined as the fraction k/n of k source symbols and n encoded symbols.
The actual maximum code rate allowed depends on the errorcorrecting code used, and may be lower. This is because Shannon's proof was only of existential nature, and did not show how to construct codes which are both optimal and have efficient encoding and decoding algorithms.
Hybrid ARQ is a combination of ARQ and forward error correction. There are two basic approaches^{[2]}:
The latter approach is particularly attractive on the binary erasure channel when using a rateless erasure code.
Applications that require low latency (such as telephone conversations) cannot use Automatic Repeat reQuest (ARQ); they must use Forward Error Correction (FEC). By the time an ARQ system discovers an error and retransmits it, the resent data will arrive too late to be any good.
Applications where the transmitter immediately forgets the information as soon as it is sent (such as most television cameras) cannot use ARQ; they must use FEC because when an error occurs, the original data is no longer available. (This is also why FEC is used in data storage systems such as RAID and distributed data store).
Applications that use ARQ must have a return channel. Applications that have no return channel cannot use ARQ.
Applications that require extremely low error rates (such as digital money transfers) must use ARQ.
In a typical TCP/IP stack, error control is performed at multiple levels:
Development of errorcorrection codes was tightly coupled with the history of deepspace missions due to the extreme dilution of signal power over interplanetary distances, and the limited power availability aboard space probes. Whereas early missions sent their data uncoded, starting from 1968 digital error correction was implemented in the form of (suboptimally decoded) convolutional codes and ReedMuller codes.^{[3]} The ReedMuller code was well suited to the noise the spacecraft was subject to (approximately matching a Bell curve), and was implemented at the Mariner spacecraft for missions between 1969 and 1977.
The Voyager 1 and Voyager 2 missions, which started in 1977, were designed to deliver color imaging amongst scientific information of Jupiter and Saturn.^{[4]} This resulted in increased coding requirements, and thus the spacecrafts were supported by (optimally Viterbidecoded) convolutional codes that could be concatenated with an outer Golay (24,12,8) code. The Voyager 2 probe additionally supported an implementation of a ReedSolomon code: the concatenated ReedSolomonViterbi (RSV) code allowed for very powerful error correction, and enabled the spacecraft's extended journey to Uranus and Neptune.
The CCSDS currently recommends usage of error correction codes with performance similar to the Voyager 2 RSV code as a minimum. Concatenated codes are increasingly falling out of favor with space missions, and are replaced by more powerful codes such as Turbo codes or LDPC codes.
The different kinds of deep space and orbital missions that are conducted suggest that trying to find a "one size fits all" error correction system will be an ongoing problem for some time to come. For missions close to earth the nature of the channel noise is different from that a spacecraft on an interplanetary mission experiences. Additionally, as a spacecraft increases its distance from earth, the problem of correcting for noise gets larger.
The demand for satellite transponder bandwidth continues to grow, fueled by the desire to deliver television (including new channels and High Definition TV) and IP data. Transponder availability and bandwidth constraints have limited this growth, because transponder capacity is determined by the selected modulation scheme and Forward error correction (FEC) rate.
Overview
Error detection and correction codes are often used to improve the reliability of data storage media.
A "parity track" was present on the first magnetic tape data storage in 1951. The "Optimal Rectangular Code" used in group code recording tapes not only detects but also corrects singlebit errors.
Some file formats, particularly archive formats, include a checksum (most often CRC32) to detect corruption and truncation and can employ redundancy and/or parity files to recover portions of corrupted data.
Reed Solomon codes are used in compact discs to correct errors caused by scratches.
Modern hard drives use CRC codes to detect and ReedSolomon codes to correct minor errors in sector reads, and to recover data from sectors that have "gone bad" and store that data in the spare sectors.^{[5]}
RAID systems use a variety of error correction techniques, to correct errors when a hard drive completely fails.
DRAM memory may provide increased protection against soft errors by relying on error correcting codes. Such errorcorrecting memory, known as ECC or EDACprotected memory, is particularly desirable for high faulttolerant applications, such as servers, as well as deepspace applications due to increased radiation.
Errorcorrecting memory controllers traditionally use Hamming codes, although some use triple modular redundancy.
Interleaving allows distributing the effect of a single cosmic ray potentially upsetting multiple physically neighboring bits across multiple words by associating neighboring bits to different words. As long as a single event upset (SEU) does not exceed the error threshold (e.g., a single error) in any particular word between accesses, it can be corrected (e.g., by a singlebit error correcting code), and the illusion of an errorfree memory system may be maintained.^{[6]}
Error detection and correction is the name for a number of technologies that are used to make sure that information or data is not corrupted, that it still makes sense.
There are different ways to make sure an error can be detected. This is done by adding more data or information to the data transmitted. Adding more data than needed is called redundancy.
Certain means allow to correct an error:
