My Contents

Saturday, July 4, 2009

Cyclic Redundancy Check error - copy errors from CD DVD

Error detection is important whenever there is a non-zero chance of your data getting corrupted. Whether it's an Ethernet packet or a file under the control of your application, you can add a piece of redundant information to validate it.

The simplest example is a parity bit. Many computers use one parity bit per byte of memory. Every time the byte gets written, the computer counts the number of non-zero bits in it. If the number is even, it sets the ninth parity bit, otherwise it clears it. When reading the byte, the computer counts the number of non-zero bits in the byte, plus the parity bit. If any of the nine bits is flipped, the sum will be odd and the computer will halt with a memory error. (Of course, if two bits are flipped--a much rarer occurrence--this system will not detect it.)

For messages longer than one byte, you'd like to store more than one bit of redundant information. You might, for instance, calculate a checksum. Just add together all the bytes in the message and append (or store somewhere else) the sum. Usually the sum is truncated to, say, 32 bits. This system will detect many types of corruption with a reasonable probability. It will, however, fail badly when the message is modified by inverting or swapping groups of bytes. Also, it will fail when you add or remove null bytes.

Calculating a Cyclic Redundancy Check is a much more robust error checking algorithm. In this article I will sketch the mathematical foundations of the CRC calculation and describe two C++ implementations--first the slow but simple one, then the more optimized one.

Polynomials

Here's a simple polynomial, 2x2 - 3x + 7. It is a function of some variable x, which depends only on powers of x. The degree of a polynomial is equal to the highest power of x in it; here it is 2 because of the x2 term. A polynomial is fully specified by listing its coefficients, in this case (2, -3, 7). Notice that to define a degree-d polynomial you have to specify d + 1 coefficients.

It's easy to multiply polynomials. For instance,

(2x2 - 3x + 7) * (x + 2)
= 2x3 + 4x2 - 3x2 - 6x + 7x + 14
= 2x3 + x2 + x + 14

Conversely, it is also possible to divide polynomials. For instance, the above equation can be rewritten as a division:

(2x3 + x2 + x + 14) / (x + 2) = 2x2 - 3x + 7

Just like in integer arithmetic, one polynomial doesn't have to be divisible by another. But you can always divide out the "whole" part and be left with the remainder. For instance x2 - 2x is not divisible by x + 1, but you can calculate the quotient to be x - 3 and the remainder to be 3:

(x2 - 2x) = (x + 1) * (x - 3) + 3

In fact you can use a version of long division to perform such calculations

Arithmetic Modulo Two

Most of us are familiar with polynomials whose coefficients are real numbers. In general, however, you can define polynomials with coefficients taken from arbitrary sets. One such set (in fact a field) consists of the numbers 0 and 1 with arithmetic defined modulo 2. It means that you perform arithmetic as usual, but if you get something greater than 1 you keep only its remainder after division by 2. In particular, if you get 2, you keep 0. Here's the addition table:

0 + 0 = 0
0 + 1 = 1 + 0 = 1
1 + 1 = 0
(because 2 has remainder 0 after dividing by 2)

The multiplication table is equally simple:

0 * 0 = 0
0 * 1 = 1 * 0 = 0
1 * 1 = 1

What's more, subtraction is also well defined (in fact the subtraction table is identical to the addition table) and so is division (except for division by zero). What is nice, from the point of view of computer programming, is that both addition and subtraction modulo 2 are equivalent to bitwise exclusive or (XOR).

Now imagine a polynomial whose coefficients are zeros and ones, with the rule that all arithmetic on these coefficients is performed modulo 2. You can add, subtract, multiply and divide such polynomials (they form a ring). For instance, let's do some easy multiplication:

(1x2 + 0x + 1) * (1x + 1)
= 1x3 + 1x2 + 0x2 + 0x + 1x + 1
= 1x3 + 1x2 + 1x + 1

Let's now simplify our notation by representing a polynomial as a series of coefficients. For instance, 1x2 + 0x + 1 has coefficients (1, 0, 1), 1x + 1 (1, 1), and 1x3 + 1x2 + 1x + 1 (1, 1, 1, 1).

Do you see what I am driving at? A polynomial with coefficients modulo 2 can be represented as a series of bits. Conversely, any series of bits can be looked upon as a polynomial. In particular any binary message, which is nothing but a series of bits, is equivalent to a polynomial.

CRC

Take a binary message and convert it to a polynomial then divide it by another predefined polynomial called the key. The remainder from this division is the CRC. Now transmit both the message and the CRC. The recipient of the transmission does the same operation (divides the message by the same key) and compares his CRC with yours. If they differ, the message must have been mangled. If, on the other hand, they are equal, the odds are pretty good that the message went through uncorrupted. Most localized corruptions (burst of errors) will be caught using this scheme.

Not all keys are equally good. The longer the key, the better error checking. On the other hand, the calculations with long keys can get pretty involved. Ethernet packets use a 32-bit CRC corresponding to degree-31 remainder (remember, you need d + 1 coefficients for a degree-d polynomial). Since the degree of the remainder is always less than the degree of the divisor, the Ethernet key must be a polynomial of degree 32. A polynomial of degree 32 has 33 coefficients requiring a 33-bit number to store it. However, since we know that the highest coefficient (in front of x32) is 1, we don't have to store it. The key used by the Ethernet is 0x04c11db7. It corresponds to the polynomial:

x32 + x26 + ... + x2 + x + 1

There is one more trick used in packaging CRCs. First calculate the CRC for a message to which you have appended 32 zero bits. Suppose that the message had N bits, thus corresponding to degree N-1 polynomial. After appending 32 bits, it will correspond to a degree N + 31 polynomial. The top-level bit that was multiplying xN-1 will be now multiplying xN+31 and so on. In all, this operation is equivalent to multiplying the message polynomial by x32. If we denote the original message polynomial by M (x), the key polynomial by K (x) and the CRC by R (x) (remainder) we have:

M * x32 = Q (x) * K (x) + R (x)

Now add the CRC to the augmented message and send it away. When the recipient calculates the CRC for this sum, and there was no transmission error, he will get zero. That's because:

M * x32 + R (x) = Q (x) * K (x) (no remainder!)

You might think I made a sign mistake--it should be -R (x) on the left. Remember, however, that in arithmetic modulo 2 addition and subtraction are the same!

Recover data lost due to cyclic redundancy check errors

There are plenty of technical resources on the Web that discuss cyclic redundancy checks (CRCs). Most times you won't need to worry about this technobabble. That is, until one it day it suddenly appears and you think - what the hell does that mean? In simple terms, a CRC is bit of mathematics used to ensure that your data is OK when being transfered. It's a checking procedure that quickly identifies when data has been damaged. If you get this message, it means that the file being read by your PC or software is corrupted. However, it does not mean all the data is lost forever. When data is transfered, it is usually in small blocks and each block is given a CRC value. If something goes wrong with the data between the time it leaves the source and arrives at its destination, the CRC sent at the source will no longer match the one that is calculated when the data arrives - this is when the cyclic redundancy check error will appear.
The most common time you will see the cyclic redundancy check error message is when trying to read data from a damaged CD or DVD. Just before it appears, your CD/DVD drive will probably grind and whirl away - your PC may also become a little slugglish.

Less frequent causes are the result of system crashes, and buggy software (hello Microsoft), incomplete downloads (often identified by the misleading message 'This is not a valid Windows file', 'This is not a valid win32 application' or 'Corrupt Zip file'). If this problem happens frequently with downloads, try using a download manager.

For CDs and DVDs, the problem is a little different. Normally, when CD/DVD drives get a CRC message from a disc, they try to read the disc again - hence the grinding sound. After several failed attempts, they give up and display the redundancy check error. The problem can be hardware (loose cables, failing drive), software or damaged media. In most cases checking and cleaning the disc is the easiest way to overcome the problem. If different clean discs produce the same error, it is likely to be a hardware issue (check the discs in another drive). Another common cause of these errors is poorly burnt CDs and DVDs - especially those that had numerous or severe buffer underuns. USB burners suffer from this problem when the burn speed is too high (generally above 4X-8X)

If the discs are damaged, you'll probably need a recovery tool to get back your data. CDCheck 3 will work for CDs and DVDs. First it will check the media, and then you have the option to recover the files. It's free for personal use and has saved many people heartache when it comes to recovering lost digital images and videos from damaged CDs.




You are here: Cyclic redundancy check data error - what it means for your data, CD and DVD.

How to:Prevent cyclic redundancy check data errors (CRC Errors)

There are plenty of technical resources on the Web that discuss cyclic redundancy checks (CRCs). Most times you won't need to worry about this technobabble. That is, until one it day it suddenly appears and you think - what the hell does that mean? In simple terms, a CRC is bit of mathematics used to ensure that your data is OK when being transfered. It's a checking procedure that quickly identifies when data has been damaged. If you get this message, it means that the file being read by your PC or software is corrupted. However, it does not mean all the data is lost forever. When data is transfered, it is usually in small blocks and each block is given a CRC value. If something goes wrong with the data between the time it leaves the source and arrives at its destination, the CRC sent at the source will no longer match the one that is calculated when the data arrives - this is when the cyclic redundancy check error will appear. The most common time you will see the cyclic redundancy check error message is when trying to read data from a damaged CD or DVD. Just before it appears, your CD/DVD drive will probably grind and whirl away - your PC may also become a little slugglish.

Less frequent causes are the result of system crashes, and buggy software (hello Microsoft), incomplete downloads (often identified by the misleading message 'This is not a valid Windows file', 'This is not a valid win32 application' or 'Corrupt Zip file'). If this problem happens frequently with downloads, try using a download manager.

For CDs and DVDs, the problem is a little different. Normally, when CD/DVD drives get a CRC message from a disc, they try to read the disc again - hence the grinding sound. After several failed attempts, they give up and display the redundancy check error. The problem can be hardware (loose cables, failing drive), software or damaged media. In most cases checking and cleaning the disc is the easiest way to overcome the problem. If different clean discs produce the same error, it is likely to be a hardware issue (check the discs in another drive). Another common cause of these errors is poorly burnt CDs and DVDs - especially those that had numerous or severe buffer underuns. USB burners suffer from this problem when the burn speed is too high (generally above 4X-8X)

If the discs are damaged, you'll probably need a recovery tool to get back your data. CDCheck 3 will work for CDs and DVDs. First it will check the media, and then you have the option to recover the files. It's free for personal use and has saved many people heartache when it comes to recovering lost digital images and videos from damaged CDs.


You are here: Cyclic redundancy check data error - what it means for your data, CD and DVD.

Cyclic Redundancy Check (CRC)

Introduction

The CRC is a very powerful but easily implemented technique to obtain data reliability. The CRC technique is used to protect blocks of data called Frames. Using this technique, the transmitter appends an extra n- bit sequence to every frame called Frame Check Sequence (FCS). The FCS holds redundant information about the frame that helps the transmitter detect errors in the frame. The CRC is one of the most used techniques for error detection in data communications. The technique gained its popularity because it combines three advantages:

  • Extreme error detection capabilities.
  • Little overhead.
  • Ease of implementation.

The following sections will explain the CRC more in depth:

Cyclic redundancy check

A cyclic redundancy check (CRC) is a non-secure hash function designed to detect accidental changes to raw computer data, and commonly used in digital networks and storage devices such as hard disk drives. A CRC-enabled device calculates a short, fixed-length binary sequence, known as the CRC code or just CRC, for each block of data and sends or stores them both together. When a block is read or received the device repeats the calculation; if the new CRC does not match (or in some cases, cancel out) the one calculated earlier then the block contains a data error and the device may take corrective action such as rereading or requesting the block be sent again.[1]

CRCs are so called as the check (data verification) code is a redundancy (it adds zero information) and cyclic (the message data circulates in the check code during calculation).[citation needed] The term CRC may refer to the check code or to the function that calculates it, which accepts data streams of any length as input but always outputs a fixed-length code. CRCs are popular because they are simple to implement in binary hardware, are easy to analyse mathematically, and are particularly good at detecting common errors caused by noise in transmission channels. The CRC was invented by W. Wesley Peterson, and published in his 1961 paper.[2] The IEEE-recommended 32-bit CRC, used in Ethernet and elsewhere, appeared at a telecommunications conference in 1975.[3]


Introduction

A CRC is an error-detecting code. Its computation resembles a long division operation in which the quotient is discarded and the remainder becomes the result, with the important distinction that the arithmetic used is the carry-less arithmetic of a finite field. The length of the remainder is always less than or equal to the length of the divisor, which therefore determines how long the result can be. The definition of a particular CRC specifies the divisor to be used, among other things.

Although CRCs can be constructed using any finite field, all commonly used CRCs employ the finite field GF(2). This is the field of two elements, usually called 0 and 1, comfortably matching computer architecture. The rest of this article will discuss only these binary CRCs, but the principles are more general.

An important reason for the popularity of CRCs for detecting the accidental alteration of data is their efficiency guarantee. Typically, an n-bit CRC, applied to a data block of arbitrary length, will detect any single error burst not longer than n bits (in other words, any single alteration that spans no more than n bits of the data), and will detect a fraction 1-2-n of all longer error bursts. Errors in both data transmission channels and magnetic storage media tend to be distributed non-randomly (i.e. are "bursty"), making CRCs' properties more useful than alternative schemes such as multiple parity checks.

The simplest error-detection system, the parity bit, is in fact a trivial CRC: it uses the two-bit-long divisor 11.

CRCs and data integrity

CRCs are not, by themselves, suitable for protecting against intentional alteration of data (for example, in authentication applications for data security), because their convenient mathematical properties make it easy to compute the CRC adjustment required to match any given change to the data.

It is often falsely assumed[4] that when a message and its CRC are received from an open channel and the CRC matches the message's calculated CRC then the message cannot have been altered in transit. This is of course false, because both could have been changed, such that the new CRC would match the new message. Therefore, CRCs can be relied upon to verify correctness but not integrity.

Although CRCs share a problem with message digests in that there cannot be a 1:1 relationship between all possible messages and all possible CRCs, the CRC function fares worse because it is not a trapdoor function. That is, it is easy to generate other messages that result in the same CRC, especially messages similar to the original. By design, however, a message that is too similar (differing only by a trivial noise pattern) will have a dramatically different CRC and thus be detected.

In contrast, an effective way to protect messages against intentional tampering is by the use of a message authentication code such as HMAC.

Computation of CRC

To compute an n-bit binary CRC, line the bits representing the input in a row, and position the (n+1)-bit pattern representing the CRC's divisor (called a "polynomial") underneath the left-hand end of the row. Here is the first calculation for computing a 3-bit CRC:

11010011101100 <--- Input
1011 <--- divisor (4 Bits)
--------------
01100011101100 <--- result

If the input bit above the leftmost divisor bit is 0, do nothing and move the divisor to the right by one bit. If the input bit above the leftmost divisor bit is 1, the divisor is exclusive-ORed into the input (in other words, the input bit above each 1-bit in the divisor is toggled). The divisor is then shifted one bit to the right, and the process is repeated until the divisor reaches the right-hand end of the input row. Here is the last calculation:

00000000001110 <--- result of multiplication calculation
1011 <--- divisor
--------------
00000000000101 <--- remainder (3 bits)

Since the leftmost divisor bit zeroed every input bit it touched, when this process ends the only bits in the input row that can be nonzero are the n bits at the right-hand end of the row. These n bits are the remainder of the division step, and will also be the value of the CRC function (unless the chosen CRC specification calls for some postprocessing).

[edit] Mathematics of CRC

Mathematical analysis of this division-like process reveals how to pick a divisor that guarantees good error-detection properties. In this analysis, the digits of the bit strings are thought of as the coefficients of a polynomial in some variable x—coefficients that are elements of the finite field GF(2) instead of more familiar numbers. This "polynomial trick" allows bit strings to be viewed as elements of a ring. A ring is, loosely speaking, a set of elements somewhat like numbers, that can be operated on by an operation that somewhat resembles addition and another operation that somewhat resembles multiplication, these operations possessing many of the familiar arithmetic properties of commutativity, associativity, and distributivity. Many analytical tools commonly used with numbers also work on rings, and this is why the "polynomial" view helps the analysis.

Specification of CRC

The concept of the CRC as an error-detecting code gets complicated when an implementer or standards committee turns it into a practical system. Here are some of the complications:

  • Sometimes an implementation prefixes a fixed bit pattern to the bitstream to be checked. This is useful when clocking errors might insert 0-bits in front of a message, an alteration that would otherwise leave the CRC unchanged.
  • Sometimes an implementation appends n 0-bits (n being the size of the CRC) to the bitstream to be checked before the polynomial division occurs. This has the convenience that the CRC of the original bitstream with the CRC appended is exactly zero, so the CRC can be checked simply by performing the polynomial division on the expanded bitstream and comparing the remainder with zero.
  • Sometimes an implementation exclusive-ORs a fixed bit pattern into the remainder of the polynomial division.
  • Bit order: Some schemes view the low-order bit of each byte as "first", which then during polynomial division means "leftmost", which is contrary to our customary understanding of "low-order". This convention makes sense when serial-port transmissions are CRC-checked in hardware, because some widespread serial-port transmission conventions transmit bytes least-significant bit first.
  • Byte order: With multi-byte CRCs, there can be confusion over whether the byte transmitted first (or stored in the lowest-addressed byte of memory) is the least-significant byte or the most-significant byte. For example, some 16-bit CRC schemes swap the bytes of the CRC.
  • Omission of the high-order bit of the divisor polynomial: Since the high-order bit is always 1, and since an n-bit CRC must be defined by an (n + 1)-bit divisor which overflows an n-bit register, some writers assume that it is unnecessary to mention the divisor's high-order bit.

Commonly used and standardised CRCs

While cyclic redundancy checks form part of several standards, they are not themselves standardised to the point of adopting one algorithm of each degree worldwide: there are two polynomials reported for CRC-12[5], ten documented variations of CRC-16, and four of CRC-32[6]. The polynomials usually seen are not the most efficient ones possible. Between 1993 and 2004, Koopman, Castagnoli and others surveyed the space of polynomials up to 16 bits[7], and of 24 and 32 bits,[8][9] finding examples that have much better performance (in terms of Hamming distance for a given message size) than the polynomials of earlier protocols, and publishing the best of these with the aim of improving the error detection capacity of future standards[9]. In particular, iSCSI has adopted one of the findings of this research.

Far from being arbitrarily chosen, the popular CRC-32 polynomial, recommended by the IEEE and used by V.42, Ethernet, the POSIX cksum utility, FDDI and ZIP and PNG files among others, is the generating polynomial of a Hamming code and was selected for its error detection performance[3] on communication channels. Even so, it is outperformed by the Castagnoli CRC-32C polynomial used in iSCSI[9] on Internet SCSI environments. The ITU-T G.hn standard also uses the Castagnoli CRC-32C polynomial to detect errors in payload (although it uses CRC-16-CCITT for PHY headers).

The table below lists only the polynomials of the various algorithms in use. Any particular protocol can impose pre-inversion, post-inversion and reversed bit ordering as described above. CRCs in proprietary protocols might use a complicated initial value and final XOR for obfuscation but this does not add cryptographic strength to the algorithm.

Note: in this table the high-order bit is omitted; see Specification of CRC above.

Name Polynomial Representations: normal or reversed (reverse of reciprocal)
CRC-1 x + 1 (most hardware; also known as parity bit) 0x1 or 0x1 (0x1)
CRC-4-ITU x4 + x + 1 (ITU G.704, p. 12) 0x3 or 0xC (0x9)
CRC-5-EPC x5 + x3 + 1 (Gen 2 RFID[10]) 0x09 or 0x12 (0x14)
CRC-5-ITU x5 + x4 + x2 + 1 (ITU G.704, p. 9) 0x15 or 0x15 (0x1A)
CRC-5-USB x5 + x2 + 1 (USB token packets) 0x05 or 0x14 (0x12)
CRC-6-ITU x6 + x + 1 (ITU G.704, p. 3) 0x03 or 0x30 (0x21)
CRC-7 x7 + x3 + 1 (telecom systems, MMC,SD) 0x09 or 0x48 (0x44)
CRC-8-ATM x8 + x2 + x + 1 (ATM HEC) 0x07 or 0xE0 (0x83)
CRC-8-CCITT x8 + x7 + x3 + x2 + 1 (1-Wire bus) 0x8D or 0xB1 (0xC6)
CRC-8-Dallas/Maxim x8 + x5 + x4 + 1 (1-Wire bus) 0x31 or 0x8C (0x98)
CRC-8 x8 + x7 + x6 + x4 + x2 + 1 0xD5 or 0xAB (0xEA [7])
CRC-8-SAE J1850 x8 + x4 + x3 + x2 + 1 0x1D or 0xB8 (0x8E)
CRC-10 x10 + x9 + x5 + x4 + x + 1 0x233 or 0x331 (0x319)
CRC-11 x11 + x9 + x8 + x7 + x2 + 1 (FlexRay[11]) 0x385 or 0x50E (0x5C2)
CRC-12 x12 + x11 + x3 + x2 + x + 1 (telecom systems, [12][13] ) 0x80F or 0xF01 (0xC07)
CRC-15-CAN x15 + x14 + x10 + x8 + x7 + x4 + x3 + 1 0x4599 or 0x4CD1 (0x62CC)
CRC-16-Fletcher Not a CRC; see Fletcher's checksum Used in Adler-32 A & B CRCs
CRC-16-CCITT x16 + x12 + x5 + 1 (G.hn PHY headers, 802.15.4, X.25, V.41, CDMA, Bluetooth, XMODEM, HDLC,PPP, IrDA, BACnet; known as CRC-CCITT, MMC,SD) 0x1021 or 0x8408 (0x8810 [7])
CRC-16-DNP x16 + x13 + x12 + x11 + x10 + x8 + x6 + x5 + x2 + 1 (DNP, IEC 870, M-Bus) 0x3D65 or 0xA6BC (0x9EB2)
CRC-16-IBM x16 + x15 + x2 + 1 (SDLC, USB, many others; also known as CRC-16) 0x8005 or 0xA001 (0xC002)
CRC-24 x24 + x22 + x20 + x19 + x18 + x16 + x14 + x13 + x11 + x10 + x8 + x7 + x6 + x3 + x + 1 (FlexRay[11]) 0x5D6DCB or 0xD3B6BA (0xAEB6E5)
CRC-24-Radix-64 x24 + x23 + x18 + x17 + x14 + x11 + x10 + x7 + x6 + x5 + x4 + x3 + x + 1 (OpenPGP) 0x864CFB or 0xDF3261 (0xC3267D)
CRC-30 x30 + x29 + x21 + x20 + x15 + x13 + x12 + x11 + x8 + x7 + x6 + x2 + x + 1 (CDMA) 0x2030B9C7 or 0x38E74301 (0x30185CE3)
CRC-32-Adler Not a CRC; see Adler-32 See Adler-32
CRC-32-IEEE 802.3 x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 (V.42, MPEG-2, PNG [14], POSIX cksum) 0x04C11DB7 or 0xEDB88320 (0x82608EDB [9])
CRC-32C (Castagnoli) x32 + x28 + x27 + x26 + x25 + x23 + x22 + x20 + x19 + x18 + x14 + x13 + x11 + x10 + x9 + x8 + x6 + 1 (G.hn payload) 0x1EDC6F41 or 0x82F63B78 (0x8F6E37A0 [9])
CRC-32K (Koopman) x32 + x30 + x29 + x28 + x26 + x20 + x19 + x17 + x16 + x15 + x11 + x10 + x7 + x6 + x4 + x2 + x + 1 0x741B8CD7 or 0xEB31D82E (0xBA0DC66B [9])
CRC-32Q x32 + x31 + x24 + x22 + x16 + x14 + x8 + x7 + x5 + x3 + x + 1 (aviation; AIXM [15]) 0x814141AB or 0xD5828281 (0xC0A0A0D5)
CRC-64-ISO x64 + x4 + x3 + x + 1 (HDLC — ISO 3309) 0x000000000000001B or 0xD800000000000000 (0x800000000000000D)
CRC-64-ECMA-182 x64 + x62 + x57 + x55 + x54 + x53 + x52 + x47 + x46 + x45 + x40 + x39 + x38 + x37 + x35 + x33 + x32 + x31 + x29 + x27 + x24 + x23 + x22 + x21 + x19 + x17 + x13 + x12 + x10 + x9 + x7 + x4 + x + 1 (as described in ECMA-182 p.51) 0x42F0E1EBA9EA3693 or 0xC96C5795D7870F42 (0xA17870F5D4F51B49)

Known to exist, but technologically defunct—mainly replaced by cryptographic hash functions:

  • CRC-128 (IEEE)
  • CRC-256 (IEEE)

Designing CRC polynomials

The selection of generator polynomial is the most important part of implementing the CRC algorithm. The polynomial must be chosen to maximise the error detecting capabilities while minimising overall collision probabilities.

The most important attribute of the polynomial is its length (the number of the highest nonzero coefficient), because of its direct influence of the length of the computed checksum.

The most commonly used polynomial lengths are

  • 9 bits (CRC-8)
  • 17 bits (CRC-16)
  • 33 bits (CRC-32)
  • 65 bits (CRC-64)

When creating a new CRC polynomial or improving an existing CRC the general mathematical advice is to use an irreducible polynomial that satisfies all polynomical irreducibility constraints from modular arithmetics.

  • Irreducibility in this case means that the polynomial cannot be divided by any polynomial except itself and 1 with zero remainder.
  • Reducible polynomials can still be used, but their error correcting and detecting capabilities will be less effective. Some applications may choose to use reducible polynomials under certain conditions.

The properties of the generator polynomial can be derived from the algorithm definition

  • CRCs with more than one nonzero coefficients are able to detect all single bit errors in the input message.
  • CRCs can be used to detect all double bit errors in the input message shorter than 2^k, where k is the length of the longest irreducible part of the polynomial.
  • If the CRC polynomial is divisible by x + 1 then no polynomial with odd number of nonzero coefficients can be divided by it. Hence, it can be used to detect odd number of errors in the input message (like single bit parity function).
  • CRC polynomials detect (single) burst errors shorter than the number of the position of the highest polynomial coefficient.

References

  1. ^ Ritter, Terry (February 1986). "The Great CRC Mystery". Dr. Dobb's Journal 11 (2): 26–34, 76–83. http://www.ciphersbyritter.com/ARTS/CRCMYST.HTM. Retrieved on 21 May 2009.
  2. ^ Peterson, W. W. and Brown, D. T. (January 1961). "Cyclic Codes for Error Detection". Proceedings of the IRE 49: 228. doi:10.1109/JRPROC.1961.287814.
  3. ^ a b Brayer, K; Hammond, J L Jr. (December 1975). "Evaluation of error detection polynomial performance on the AUTOVON channel" in National Telecommunications Conference, New Orleans, La. Conference Record 1: p. 8-21 to 8-25, New York: Institute of Electrical and Electronics Engineers.
  4. ^ "Eurocontrol – FAQ: Technologies". European Organisation for the Safety of Air Navigation. http://www.eurocontrol.int/aim/public/faq/chain_faq3.html. Retrieved on 29 April 2009. "A Cyclic Redundancy Check (CRC) is a means by which a data item may be assessed to verify that it has not been changed (either intentionally or unintentionally) since the CRC value was applied to it."
  5. ^ "(slib) Cyclic Checksum". http://os.cqu.edu.au/cgi-bin/info/info2html.cgi?(slib)Cyclic%20Checksum. Retrieved on 6 April 2008.
  6. ^ Greg Cook (29 April 2009). "Catalogue of parameterised CRC algorithms". http://homepages.tesco.net/rainstorm/crc-catalogue.htm. Retrieved on 29 April 2009.
  7. ^ a b c [|Koopman, Philip]; Chakravarty, Tridib (2004), Cyclic Redundancy Code (CRC) Polynomial Selection For Embedded Networks, http://www.ece.cmu.edu/~koopman/roses/dsn04/koopman04_crc_poly_embedded.pdf
  8. ^ Castagnoli, G.; S. Braeuer; M. Herrman (June 1993). "Optimization of Cyclic Redundancy-Check Codes with 24 and 32 Parity Bits". IEEE Transactions on Communications 41 (6): 883. doi:10.1109/26.231911. . Castagnoli's et al. work on algorithmic selection of CRC polynomials
  9. ^ a b c d e f Koopman, P. (June 2002). "32-Bit Cyclic Redundancy Codes for Internet Applications". The International Conference on Dependable Systems and Networks: 459. doi:10.1109/DSN.2002.1028931. http://citeseer.ist.psu.edu/koopman02bit.html. . Verification of Castagnoli's results by exhaustive search and some new good polynomials
  10. ^ Class-1 Generation-2 UHF RFID Protocol. 1.2.0. EPCglobal. 23 October 2008. p. 35. http://www.epcglobalinc.org/standards/uhfc1g2/uhfc1g2_1_0_9-standard-20050126.pdf. Retrieved on 21 May 2009.
  11. ^ a b FlexRay Protocol Specification. 2.1 Revision A. Flexray Consortium. 22 December 2005. p. 93.
  12. ^ Perez, A.; Wismer & Becker (1983). "Byte-Wise CRC Calculations". IEEE Micro 3 (3): 40–50. doi:10.1109/MM.1983.291120.
  13. ^ Ramabadran, T.V.; Gaitonde, S.S. (1988). "A tutorial on CRC computations". IEEE Micro 8 (4): 62–75. doi:10.1109/40.7773.
  14. ^ Thomas Boutell, Glenn Randers-Pehrson, et al. (1998-07-14). "PNG (Portable Network Graphics) Specification, Version 1.2". http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html. Retrieved on 2008-04-28.
  15. ^ AIXM Primer. 4.5. European Organisation for the Safety of Air Navigation. 20 March 2006. http://www.eurocontrol.int/aim/gallery/content/public/aicm_aixm_4_5/aixm_primer/AIXM_Primer_4.5.pdf. Retrieved on 29 April 2009.