## How does CRC work?

### Chapter  9 Different CRC algorithms

Chapter. 9.1 Introduction
The chapter 4 CRC arithmetic is a all CRC algorithms base. 1 bit shifts algorithm is realised on registers–>chapter 5 CRC Calculations. Programers use bytes mostly, not bits. The chapter 8 is about 3 table algoritms, which enable 1 bytes shifts.
Direct table method
„Left” table method with double xor for 1 byte shifts
„Right” table method with double xor for 1 byte shifts
The direct method has a didatical nature so majority of them are „Left” or „Right” table methods modifiactions.

Chapter. 9.2 How does classify CRC methods?
Ross N. Williams, the known CRC methods  popularizer created the “CRC parametric calculation algorithm  program” in  language. The base is the „Left” table method with double xor for 1 byte shifts. The program parameters  REFIN, REFOUT… enable to create the “right” or other (even not included in this course ) CRC versions. Programmer using this parameteric algorithm must have awareness that it isn’t optimal.
CRC parametric program enables the CRC methods classification. But not for all CRCs!
These  parameters are:
– NAME algorithm name
WIDTH CRC  size, 8, 16 or 32 bits mostly–>”the bigger is the better”
POLY “factor without first  bit=1
INIT initial CRC state. It was INIT=0 in this course, but there are nonzero CRC  too

REFIN
if FALSE —>The „left” method (the left bit is older so the byte has to been reversed before sending to the so-called UART)
if TRUE—–>The „right” method (the right bit is older)

REFOUT this parameter is connected with the next parameter XOROUT
if FALSE –>send the CRC to XOROUT
if TRUE—->reverse (other word -reflect) the CRC and send it to XOROUT

– XOROUT–>the final CRC value is xor-ed through XOROUT value (there was always XOROUT=0 in this course–> CRC not changed, but there are nonzero value too)
– CHECK the calculated CRC when the message A=“123456789”.Usefull when programmer tests the created CRC program.

Chapter 9.3 Reversed poly’s
The poly’s bits are reversed. For example
For CRC with algorithm standard name is X25
X25 standard: 1-0001-0000-0010-0001
–>hexa 1 01 00 02 01
X25 reversed:  1-0000-1000-0001-0001
–>hexa 1 00 80 01 01
Note
The first (not visible bit) poly’s bit is reversed too!

Chapter. 9.4 The different CRC algorithms examples
Name : “CRC-16”
Width : 16
Poly : 8005
Init : 0000
RefIn : True
RefOut : True
XorOut : 0000
Check : BB3D
Note:
The hexa type numbers are used here!

Name : “CRC-16/CITT”
Width : 16
Poly : 1021
Init : FFFF
RefIn : False
RefOut : False
XorOut : 0000
Check : ?

Name : “XMODEM”
Width : 16
Poly : 8408
Init : 0000
RefIn : True
RefOut : True
XorOut : 0000
Check : ?

Name : “ARC”
Width : 16
Poly : 8005
Init : 0000
RefIn : True
RefOut : True
XorOut : 0000
Check : ?

And the cherry on top!
CRC-32
used in the PKZip, AUTODIN II, Ethernet i FDDI.

Name : “CRC-32”
Width : 32
Poly : 04C11DB7
Init : FFFFFFFF
RefIn : True
RefOut : True
XorOut : FFFFFFFF
Check : CBF43926