<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=Computation_of_cyclic_redundancy_checks</id>
	<title>Computation of cyclic redundancy checks - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=Computation_of_cyclic_redundancy_checks"/>
	<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=Computation_of_cyclic_redundancy_checks&amp;action=history"/>
	<updated>2026-05-15T09:42:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>http://en.zaoniao.it/index.php?title=Computation_of_cyclic_redundancy_checks&amp;diff=4167&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;Computation of a cyclic redundancy check is derived from the mathematics of polynomial division, modulo two. In practice, it re...&quot;</title>
		<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=Computation_of_cyclic_redundancy_checks&amp;diff=4167&amp;oldid=prev"/>
		<updated>2019-05-04T02:37:42Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Computation of a &lt;a href=&quot;/Cyclic_redundancy_check&quot; title=&quot;Cyclic redundancy check&quot;&gt;cyclic redundancy check&lt;/a&gt; is derived from the mathematics of &lt;a href=&quot;/Mathematics_of_cyclic_redundancy_checks&quot; title=&quot;Mathematics of cyclic redundancy checks&quot;&gt;polynomial division, modulo two&lt;/a&gt;. In practice, it re...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Computation of a [[cyclic redundancy check]] is derived from the mathematics of [[Mathematics of cyclic redundancy checks|polynomial division, modulo two]]. In practice, it resembles [[long division]] of the [[Binary code|binary]] message string, with a fixed number of zeroes appended, by the &amp;quot;generator polynomial&amp;quot; string except that [[exclusive or]] operations replace subtractions. Division of this type is efficiently realised in hardware by a modified [[shift register]], and in software by a series of equivalent [[algorithm]]s, starting with simple code close to the mathematics and becoming faster (and arguably more [[obfuscated code|obfuscated]]) through [[byte]]-wise [[Parallelism (computing)|parallelism]] and [[space–time tradeoff]]s.&lt;br /&gt;
&lt;br /&gt;
Various CRC standards extend the polynomial division algorithm by specifying an initial shift register value, a final exclusive OR step and, most critically, a bit ordering ([[endianness]]). As a result, the code seen in practice deviates confusingly from &amp;quot;pure&amp;quot; division, Most commonly, a 256-entry lookup table is used, replacing the inner loop over &amp;lt;code&amp;gt;j&amp;lt;/code&amp;gt; with:&lt;br /&gt;
&lt;br /&gt;
 // Msbit-first&lt;br /&gt;
 rem = (rem '''leftShift''' 8) '''xor''' big_endian_table[string[i] '''xor''' ((leftmost 8 bits of rem) '''rightShift''' (n-8))]&lt;br /&gt;
 // Lsbit-first&lt;br /&gt;
 rem = (rem '''rightShift''' 8) '''xor''' little_endian_table[string[i] '''xor''' (rightmost 8 bits of rem)]&lt;br /&gt;
:'''Code fragment 6: Cores of table based division'''&lt;br /&gt;
&lt;br /&gt;
One of the most commonly encountered CRC algorithms is known as '''CRC-32''', used by (among others) [[Ethernet]], [[FDDI]], [[ZIP (file format)|ZIP]] and other [[archive formats]], and [[Portable Network Graphics|PNG]] [[image format]]. Its polynomial can be written msbit-first as 0x04C11DB7, or lsbit-first as 0xEDB88320. The W3C webpage on [[Portable Network Graphics|PNG]] includes an appendix with a short and simple table-driven implementation in C of CRC-32. You will note that the code corresponds to the lsbit-first byte-at-a-time pseudocode presented here, and the table is generated using the bit-at-a-time code.&lt;br /&gt;
&lt;br /&gt;
Using a 256-entry table is usually most convenient, but other sizes can be used. In small microcontrollers, using a 16-entry table to process four bits at a time gives a useful speed improvement while keeping the table small. On computers with ample storage, a -entry table can be used to process 16 bits at a time.&lt;br /&gt;
&lt;br /&gt;
=== Generating the tables ===&lt;br /&gt;
&lt;br /&gt;
The software to generate the tables is so small and fast that it is usually faster to compute them on program startup than to load precomputed tables from storage. One popular technique is to use the bit-at-a-time code 256 times to generate the CRCs of the 256 possible 8-bit bytes. However, this can be optimized significantly by taking advantage of the property that &amp;lt;code&amp;gt;table[i '''xor''' j] == table[i] '''xor''' table[j]&amp;lt;/code&amp;gt;. Only the table entries corresponding to powers of two need to be computed directly.&lt;br /&gt;
&lt;br /&gt;
In the following example code, &amp;lt;code&amp;gt;crc&amp;lt;/code&amp;gt; holds the value of &amp;lt;code&amp;gt;table[i]&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 big_endian_table[0] := 0&lt;br /&gt;
 crc := 0x8000 // ''Assuming a 16-bit polynomial''&lt;br /&gt;
 i := 1&lt;br /&gt;
 '''do''' {&lt;br /&gt;
 '''if''' crc '''and''' 0x8000 {&lt;br /&gt;
 crc := (crc '''leftShift''' 1) '''xor''' 0x1021 // ''The CRC polynomial''&lt;br /&gt;
 } '''else''' {&lt;br /&gt;
 crc := crc '''leftShift''' 1&lt;br /&gt;
 }&lt;br /&gt;
 // crc ''is the value of'' big_endian_table[i]''; let'' j ''iterate over the already-initialized entries''&lt;br /&gt;
 '''for''' j '''from''' 0 '''to''' i−1 {&lt;br /&gt;
 big_endian_table[i + j] := crc '''xor''' big_endian_table[j];&lt;br /&gt;
 }&lt;br /&gt;
 i := i '''leftshift''' 1&lt;br /&gt;
 } '''while''' i &amp;lt; 256&lt;br /&gt;
:'''Code fragment 7: Byte-at-a-time CRC table generation, MSB first'''&lt;br /&gt;
&lt;br /&gt;
 little_endian_table[0] := 0&lt;br /&gt;
 crc := 1;&lt;br /&gt;
 i := 128&lt;br /&gt;
 '''do''' {&lt;br /&gt;
 '''if''' crc '''and''' 1 {&lt;br /&gt;
 crc := (crc '''rightShift''' 1) '''xor''' 0x8408 // ''The CRC polynomial''&lt;br /&gt;
 } '''else''' {&lt;br /&gt;
 crc := crc '''rightShift''' 1&lt;br /&gt;
 }&lt;br /&gt;
 // crc ''is the value of'' little_endian_table[i]''; let'' j ''iterate over the already-initialized entries''&lt;br /&gt;
 '''for''' j '''from''' 0 '''to''' 255 '''by''' 2 &amp;amp;times; i {&lt;br /&gt;
 little_endian_table[i + j] := crc '''xor''' little_endian_table[j];&lt;br /&gt;
 }&lt;br /&gt;
 i := i '''rightshift''' 1&lt;br /&gt;
 } '''while''' i &amp;gt; 0&lt;br /&gt;
:'''Code fragment 8: Byte-at-a-time CRC table generation, LSB first'''&lt;br /&gt;
&lt;br /&gt;
In these code samples, the table index &amp;lt;code&amp;gt;i + j&amp;lt;/code&amp;gt; is equivalent to &amp;lt;code&amp;gt;i '''xor''' j&amp;lt;/code&amp;gt;; you may use whichever form is more convenient.&lt;br /&gt;
&lt;br /&gt;
=== Byte-Slicing using multiple tables ===&lt;br /&gt;
&lt;br /&gt;
=== Parallel computation without table ===&lt;br /&gt;
&lt;br /&gt;
Parallel update for a byte or a word at a time can also be done explicitly, without a table. This is normally used in high-speed hardware implementations. For each bit an equation is solved after 8 bits have been shifted in. The following tables list the equations for some commonly used polynomials, using following symbols:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| c&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; || CRC bit 7…0 (or 15…0) before update&lt;br /&gt;
|-&lt;br /&gt;
| r&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; || CRC bit 7…0 (or 15…0) after update&lt;br /&gt;
|-&lt;br /&gt;
| d&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; || input data bit 7…0&lt;br /&gt;
|-&lt;br /&gt;
| e&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; = d&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; + c&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;&lt;br /&gt;
| e&amp;lt;sub&amp;gt;p&amp;lt;/sub&amp;gt; = e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + … + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ''(parity bit)''&lt;br /&gt;
|-&lt;br /&gt;
| s&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; = d&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; + c&amp;lt;sub&amp;gt;i+8&amp;lt;/sub&amp;gt;&lt;br /&gt;
| s&amp;lt;sub&amp;gt;p&amp;lt;/sub&amp;gt; = s&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + … + s&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ''(parity bit)''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Bit-wise update equations for some CRC-8 polynomials after 8 bits have been shifted in&lt;br /&gt;
! Polynomial:&lt;br /&gt;
| (''x''&amp;lt;sup&amp;gt;7&amp;lt;/sup&amp;gt; + ''x''&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; + 1) &amp;amp;times; ''x'' ''(left-shifted CRC-7-CCITT)''&lt;br /&gt;
| ''x''&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt; + ''x''&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; + ''x''&amp;lt;sup&amp;gt;4&amp;lt;/sup&amp;gt; + 1 ''(CRC-8-Dallas/Maxim)''&lt;br /&gt;
|-&lt;br /&gt;
! Coefficients:&lt;br /&gt;
| 0x12 = (0x09 &amp;lt;&amp;lt; 1) ''([[Most significant bit|MSBF]]/normal)''&lt;br /&gt;
| 0x8c ''([[Least significant bit|LSBF]]/reverse)''&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
 r&amp;lt;sub&amp;gt;0 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;1 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;2 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;3 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;4 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;5 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;6 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;7 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
|&lt;br /&gt;
 0&lt;br /&gt;
 e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
 e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
! C code&amp;lt;br&amp;gt;fragments:&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
 uint8_t c, d, e, f, r;&lt;br /&gt;
 …&lt;br /&gt;
 e = c ^ d;&lt;br /&gt;
 f = e ^ (e &amp;gt;&amp;gt; 4) ^ (e &amp;gt;&amp;gt; 7);&lt;br /&gt;
 r = (f &amp;lt;&amp;lt; 1) ^ (f &amp;lt;&amp;lt; 4);&amp;lt;/source&amp;gt;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
 uint8_t c, d, e, f, r;&lt;br /&gt;
 …&lt;br /&gt;
 e = c ^ d;&lt;br /&gt;
 f = e ^ (e &amp;lt;&amp;lt; 3) ^ (e &amp;lt;&amp;lt; 4) ^ (e &amp;lt;&amp;lt; 6);&lt;br /&gt;
 r = f ^ (f &amp;gt;&amp;gt; 4) ^ (f &amp;gt;&amp;gt; 5);&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Bit-wise update equations for some CRC-16 polynomials after 8 bits have been shifted in&lt;br /&gt;
! Polynomial:&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | ''x''&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt; + ''x''&amp;lt;sup&amp;gt;12&amp;lt;/sup&amp;gt; + ''x''&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt; + 1 ''(CRC-16-CCITT)''&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | ''x''&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt; + ''x''&amp;lt;sup&amp;gt;15&amp;lt;/sup&amp;gt; + ''x''&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + 1 ''(CRC-16-ANSI)''&lt;br /&gt;
|-&lt;br /&gt;
! Coefficients:&lt;br /&gt;
| 0x1021 ''(MSBF/normal)''&lt;br /&gt;
| 0x8408 ''(LSBF/reverse)''&lt;br /&gt;
| 0x8005 ''(MSBF/normal)''&lt;br /&gt;
| 0xa001 ''(LSBF/reverse)''&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
 r&amp;lt;sub&amp;gt;0 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;1 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;2 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;3 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;4 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;5 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;6 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;7 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;8 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;9 &amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;10&amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;13&amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;14&amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
 r&amp;lt;sub&amp;gt;15&amp;lt;/sub&amp;gt; &amp;amp;larr;&lt;br /&gt;
|&lt;br /&gt;
 s&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 s&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 s&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
 s&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
 c&amp;lt;sub&amp;gt;8 &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;9 &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;10&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;13&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;14&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;15&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;p&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;p&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; s&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + s&amp;lt;sub&amp;gt;p&amp;lt;/sub&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
 c&amp;lt;sub&amp;gt;8 &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;p&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;9 &amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;10&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;13&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;14&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 c&amp;lt;sub&amp;gt;15&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;5&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;p&amp;lt;/sub&amp;gt; + e&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
 &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; &amp;lt;sub&amp;gt; &amp;lt;/sub&amp;gt; e&amp;lt;sub&amp;gt;p&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
! C code&amp;lt;br&amp;gt;fragments:&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
 uint8_t d, s, t;&lt;br /&gt;
 uint16_t c, r;&lt;br /&gt;
 …&lt;br /&gt;
 s = d ^ (c &amp;gt;&amp;gt; 8);&lt;br /&gt;
 t = s ^ (s &amp;gt;&amp;gt; 4);&lt;br /&gt;
 r = (c &amp;lt;&amp;lt; 8) ^&lt;br /&gt;
 t ^&lt;br /&gt;
 (t &amp;lt;&amp;lt; 5) ^&lt;br /&gt;
 (t &amp;lt;&amp;lt; 12);&amp;lt;/source&amp;gt;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
 uint8_t d, e, f;&lt;br /&gt;
 uint16_t c, r;&lt;br /&gt;
 …&lt;br /&gt;
 e = c ^ d;&lt;br /&gt;
 f = e ^ (e &amp;lt;&amp;lt; 4);&lt;br /&gt;
 r = (c &amp;gt;&amp;gt; 8) ^&lt;br /&gt;
 (f &amp;lt;&amp;lt; 8) ^&lt;br /&gt;
 (f &amp;lt;&amp;lt; 3) ^&lt;br /&gt;
 (f &amp;gt;&amp;gt; 4);&amp;lt;/source&amp;gt;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
 uint8_t d, s, p;&lt;br /&gt;
 uint16_t c, r, t;&lt;br /&gt;
 …&lt;br /&gt;
 s = d ^ (c &amp;gt;&amp;gt; 8);&lt;br /&gt;
 p = s ^ (s &amp;gt;&amp;gt; 4);&lt;br /&gt;
 p = p ^ (p &amp;gt;&amp;gt; 2);&lt;br /&gt;
 p = p ^ (p &amp;gt;&amp;gt; 1);&lt;br /&gt;
 p = p &amp;amp; 1;&lt;br /&gt;
 t = p | (s &amp;lt;&amp;lt; 1);&lt;br /&gt;
 r = (c &amp;lt;&amp;lt; 8) ^&lt;br /&gt;
 (t &amp;lt;&amp;lt; 15) ^&lt;br /&gt;
 t ^&lt;br /&gt;
 (t &amp;lt;&amp;lt; 1);&amp;lt;/source&amp;gt;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
 uint8_t d, e, p;&lt;br /&gt;
 uint16_t c, r, f;&lt;br /&gt;
 …&lt;br /&gt;
 e = c ^ d;&lt;br /&gt;
 p = e ^ (e &amp;gt;&amp;gt; 4);&lt;br /&gt;
 p = p ^ (p &amp;gt;&amp;gt; 2);&lt;br /&gt;
 p = p ^ (p &amp;gt;&amp;gt; 1);&lt;br /&gt;
 p = p &amp;amp; 1;&lt;br /&gt;
 f = e | (p &amp;lt;&amp;lt; 8);&lt;br /&gt;
 r = (c &amp;gt;&amp;gt; 8) ^&lt;br /&gt;
 (f &amp;lt;&amp;lt; 6) ^&lt;br /&gt;
 (f &amp;lt;&amp;lt; 7) ^&lt;br /&gt;
 (f &amp;gt;&amp;gt; 8);&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Two-step computation ===&lt;br /&gt;
As the CRC-32 polynomial has a large number of terms, when computing the remainder a byte at a time each bit depends on several bits of the previous iteration. In byte-parallel hardware implementations this calls for either multiple-input or cascaded XOR gates which increases [[propagation delay]].&lt;br /&gt;
&lt;br /&gt;
To maximise computation speed, an ''intermediate remainder'' can be calculated by passing the message through a 123-bit shift register. The polynomial is a carefully selected multiple of the standard polynomial such that the terms (feedback taps) are widely spaced, and no bit of the remainder is XORed more than once per byte iteration. Thus only two-input XOR gates, the fastest possible, are needed. Finally the intermediate remainder is divided by the standard polynomial in a second shift register to yield the CRC-32 remainder.&lt;br /&gt;
&lt;br /&gt;
== One-pass checking ==&lt;br /&gt;
When appending a CRC to a message, it is possible to detach the transmitted CRC, recompute it, and verify the recomputed value against the transmitted one. However, a simpler technique is commonly&lt;br /&gt;
used in hardware.&lt;br /&gt;
&lt;br /&gt;
When the CRC is transmitted with the correct byte order (matching the chosen bit-ordering convention), a receiver can compute an overall CRC, over the message ''and'' the CRC, and if they are correct, the result will be zero. This possibility is the reason that most network protocols that include a CRC do so ''before'' the ending delimiter; it is not necessary to know whether the end of the packet is imminent to check the CRC.&lt;br /&gt;
&lt;br /&gt;
== CRC variants ==&lt;br /&gt;
In practice, most standards specify presetting the register to all-ones and inverting the CRC before transmission. This has no effect on the ability of a CRC to detect changed bits, but gives it the ability to notice bits that are added to the message.&lt;br /&gt;
&lt;br /&gt;
=== Preset to −1 ===&lt;br /&gt;
The basic mathematics of a CRC accepts (considers as correctly transmitted) messages which, when interpreted as a polynomial, are a multiple of the CRC polynomial. If some leading 0 bits are prepended to such a message, they will not change its interpretation as a polynomial. This is equivalent to the fact that 0001 and 1 are the same number.&lt;br /&gt;
&lt;br /&gt;
But if the message being transmitted does care about leading 0 bits, the inability of the basic CRC algorithm to detect such a change is undesirable. If it is possible that a transmission error could add such bits, a simple solution is to start with the &amp;lt;code&amp;gt;rem&amp;lt;/code&amp;gt; shift register set to some non-zero value; for convenience, the all-ones value is typically used. This is mathematically equivalent to complementing (binary NOT) the first ''n'' bits of the message, where ''n'' is the number of bits in the CRC register.&lt;br /&gt;
&lt;br /&gt;
This does not affect CRC generation and checking in any way, as long as both generator and checker use the same initial value. Any non-zero initial value will do, and a few standards specify unusual values, but the all-ones value (−1 in twos complement binary) is by far the most common. Note that a one-pass CRC generate/check will still produce a result of zero when the message is correct, regardless of the preset value.&lt;br /&gt;
&lt;br /&gt;
=== Post-invert ===&lt;br /&gt;
The same sort of error can occur at the end of a message. Appending 0 bits to a message is equivalent to multiplying its polynomial by ''x'', and if it was previously a multiple of the CRC polynomial, the result of that multiplication will be, as well. This is equivalent to the fact that, since 726 is a multiple of 11, so is 7260.&lt;br /&gt;
&lt;br /&gt;
A similar solution can be applied at the end of the message, inverting the CRC register before it is appended to the message. Again, any non-zero change will do; inverting all the bits (XORing with an all-ones pattern) is simply the most common.&lt;br /&gt;
&lt;br /&gt;
This has an effect on one-pass CRC checking: instead of producing a result of zero when the message is correct, it produces a constant non-zero result. (To be precise, the result is the CRC (without non-zero preset, but with post-invert) of the inversion pattern.) Once this constant has been obtained (most easily by performing a one-pass CRC generate/check on an arbitrary message), it can be used directly to verify the correctness of any other message checked using the same CRC algorithm.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[List of hash functions]]&lt;br /&gt;
* [[Fletcher's checksum]]&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
&lt;br /&gt;
[http://wikipedia.org/ http://wikipedia.org/]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
		
	</entry>
</feed>