MiscEl: CRC and checksum

Back to MiscEl main page Write a message to author

Calculate crc and/or checksums, many different algorithms and data formats.
Checksums Simple datacheck
CRC Advanced datacheck
modulus Number check, usual used for manuel entry and barcode number check


CRC 8CRC with 8 bit polynomial, a useable polynomial is $07, see CRC calculations for coding examples
CRC 16CRC with 16 bit polynomial, see CRC calculations for coding examples
CRC 16 stdUse the $8005 polynomial, see CRC calculations for coding examples
CRC 16 CCITTUse the $1021 polynomial, see CRC calculations for coding examples
CRC 32CRC with 32 bit polynomial, see CRC calculations for coding examples
CRC 32 std.Use the $04C11DB7 polynomial, see CRC calculations for coding examples
CRC 32 I.363Same as above, but other settings, see CRC calculations for coding examples
ChecksumAdd all bytes
Checksum with zero resultAdd all bytes and negate the result
XorXor all bytes
16 bit checksumAdd all bytes in a 16 bit register
ModulusModulus check, used for numerical strings
Modulus 10 arithmeticMod 10 with 21 weights
Modulus 10 geometricMod 10 with 731 weights
Modulus 10 MSIMod 10 with 21 weights and "SumDigits"
Modulus 10 UPC/EANMod 10 with 13 weights
Modulus 11 arithmeticMod 11 with 234567 weights
Modulus 11 geometricMod 11 with 2,4,8,5,10,9,7,3,6,1 weights
Modulus 11 danish CPRMod 11 with 765432 weights
Guess with checksumTry to guess a checksum algorithm from a known checksum.
GuessTry to guess what checksum algorithm was used on the data. It is assumed that the last databyte(s) contains the checksum.
Data viewList all the data in hex format, used to verify that the input is correctly read

Data format

It is very important to select the correct dataformat!
Hex/TextA mix of numbers and text strings. Any number is supposed to be in hex and text must have quotes around it
ExpressionSame syntax as in Calculator, expression can be delimetered with ;
Hex dumpWill decode typical hex dumps formats. I.e.: "address data text", the address and data fields are required, the text field is optional
TextAny text, leading and trailing spaces and newlines are ignored
Text and spacesAny text, only newlines are ignored


InitialInitial value for calculations
AltAnother way to express the same initial value, the releation between "Initial" and "Alt" will depend on the agorithm
Final XorInvert some or all of the result bits
PolynomThe CRC polynomial, X^(n-1) first and X^0 last, X^n is assumed to be 1
InvertedThe CRC polynomial, X^0 first and x^(n-1) last, x^n is assumed to be 1
Reverse dataReverse (reflect) data bits before procession
Reverse resultReverse (reflect) result bits after procession, usual used together with "Reverse data"
ModulusModulus usual 10 or 11, but other values can be used. For digits above 9 use letters (A=10, B=11 etc.)
WeightsValues to multiply the digits with.
The weights are specied as a list of numbers
ReminderReminder to display, usual calculated as "modulus-reminder"
The reminders are specied as a list of numbers, one for each reminder value
Apply weight from leftSelect between applying weight from left or right
Sum digitsIn modulus the sum is calculated from the weights. I.e. a 9 digit with a 3 weight adds 9*3=27 to the weight, but when this parameter is checked it will give 2+7=9 to the weight
Edit paramsPress this buttoms to copy the parameters to the generic algorithm


The first part of the output is just a list of the parameters used.
Some values are also listet as ascii values, this is a combination of characters, character names and hex values
When doing modulus checks, two calculations are done:
1) A modulus digit is calculated for the number
2) The number is assumed to contain a modulus digit and a check is performed

To get a pregenerated crc table, select the data format with the "Save format" checkbox and press "Save".
CaveatDo not specify an inverted polynom, when "Reverse data" are checkmarked the necessary bit manipulation are done automatic.


Calculator functions

The Calculator also support some crc calculations:

Other pages