Cyclic redundancy check - 107 CRC Calculations

This VB6 project was developed to generate the CRC Lookup tables, and was extended to include a comprehensive range of CRC algorithms.

The source of the 107 CRC algorithms are those provided by Greg Cook http://reveng.sourceforge.net. Greg has created a catalogue of parameterised CRC algorithms.

As well as creating the CRC tables, this project also calculates the CRC value, and validates polynomials against the check value included in the algorithms.

These 107 CRC polynomial’s range in size from 3 bits to 82 bits and in this project the calculations are performed using byte arrays which are sized to fit the width of each CRC polynomial. As an example, the code to calculate the polynomial with refin = false, such as the XMODEM CRC, is

For i = LBound(baData) To UBound(baData)
baCRC(UBound(baCRC)) = baCRC(UBound(baCRC)) Xor baData(i)
For j = 1 To 8
If baCRC((UBound(baCRC))) And &H80 Then
baSHL baCRC, 1 ' <<1
baXOR baCRC, baPoly
Else
baSHL baCRC, 1 ' <<1
End If
Next j
Next i
Where baData is a byte array of the data, baCRC is a byte array of the calculated CRC value, baPoly is a byte array of the Polynomial.
Where baSHL is a sub procedure to bit shift a byte array to the left, baXOR is a sub procedure to Xor the bits of two byte arrays.

For the XMODEM type of polynomial (where the algorithm member refin is false), the polynomial and the CRC byte arrays are shifted left to the high bit before the calculation, and then the result is shifted back after the calculation. This enables the expression "baCRC((UBound(baCRC))) And &H80" to be used with any width of polynomial of the type refin = false.

For details see the document “CRC Project.rtf” in the attached zip file.

David
Attachment CRCalgorithm.zip