How to calculate CRC8 & CRC16 in MTools

CRC – Cyclic Redundancy Check is widely used in data transition. According to wikipedia.org, A CRC-enabled device calculates a short, fixed-length binary sequence, known as the check value or CRC, for each block of data to be sent or stored and appends it to the data, forming a codeword.

When a codeword is received or read, the device either compares its check value with one freshly calculated from the data block or equivalently, performs a CRC on the whole codeword and compares the resulting check value with an expected residue constant. If the CRC values do not match, then the block contains an error.

It’s really hard to calculate CRC value by calculator, so I add CRC8 & CRC16 algorithm in MTools.
And this can really save your time to get the CRC values by one expression.
Notice: This is the feature for full version.


Byte values

There exist 16 bytes on each block of the mifare 1k card.
And you can use b0 b1 b2b14 b15 for caculation.

CRC8

The value of CRC8 result is only 1 byte. Available CRC8 algorithm in MTools.

AlgorithmExpressionValue
CRC-8crc8(0,1,5,8)CRC8 of HEX String of b0 b1 b5 b8
CRC-8/CDMA2000crc8cdma2000(0:14)CRC8-/CDMA2000 of b0 to b14
CRC-8/DARCcrc8darc(0:14)idem
CRC-8/DVB-S2crc8dvs2(0:14)idem
CRC-8/EBUcrc8eu(0:14)idem
CRC-8/I-CODEcrc8icode(0:14)idem
CRC-8/ITUcrc8itu(0:14)idem
CRC-8/MAXIMcrc8maxim(0:14)idem
CRC-8/ROHCcrc8rohc(0:14)idem
CRC-8/WCDMAcrc8wcdma(0:14)idem

CRC16

The value of CRC16 contains 2 bytes.
To get these two seperately, 0 or 1 need to be added after the expression.
Supported CRC16 algorithm in MTools.

AlgorithmExpression 0Expression 1Xor Value
CRC-16/CCITT-FALSEcrc16ccittfalse(0:14)0crc16ccittfalse(0:14)1crc16ccittfalse(0:14)
CRC-16/ARCcrc16arc(0:14)0crc16arc(0:14)1crc16arc(0:14)
CRC-16/AUG-CCITTcrc16augccitt(0:14)0crc16augccitt(0:14)1crc16augccitt(0:14)
CRC-16/BUYPASScrc16buypass(0:14)0crc16buypass(0:14)1crc16buypass(0:14)
CRC-16/CDMA2000crc16cdma2000(0:14)0crc16cdma2000(0:14)1crc16cdma2000(0:14)
CRC-16/DDS-110crc16dds110(0:14)0crc16dds110(0:14)1crc16dds110(0:14)
CRC-16/DECT-Rcrc16dectr(0:14)0crc16dectr(0:14)1crc16dectr(0:14)
CRC-16/DECT-Xcrc16dectx(0:14)0crc16dectx(0:14)1crc16dectx(0:14)
CRC-16/DNPcrc16dnp(0:14)0crc16dnp(0:14)1crc16dnp(0:14)
CRC-16/EN-13757crc16en13757(0:14)0crc16en13757(0:14)1crc16en13757(0:14)
CRC-16/GENIBUScrc16genibus(0:14)0crc16genibus(0:14)1crc16genibus(0:14)
CRC-16/MAXIMcrc16maxim(0:14)0crc16maxim(0:14)1crc16maxim(0:14)
CRC-16/MCRF4XXcrc16mcrf4xx(0:14)0crc16mcrf4xx(0:14)1crc16mcrf4xx(0:14)
CRC-16/RIELLOcrc16riello(0:14)0crc16riello(0:14)1crc16riello(0:14)
CRC-16/T10-DIFcrc16t10dif(0:14)0crc16t10dif(0:14)1crc16t10dif(0:14)
CRC-16/TELEDISKcrc16teledisk(0:14)0crc16teledisk(0:14)1crc16teledisk(0:14)
CRC-16/TMS37157crc16tms37157(0:14)0crc16tms37157(0:14)1crc16tms37157(0:14)
CRC-16/USBcrc16usb(0:14)0crc16usb(0:14)1crc16usb(0:14)
CRC-Acrc16a(0:14)0crc16a(0:14)1crc16a(0:14)
CRC-16/KERMITcrc16kermit(0:14)0crc16kermit(0:14)1crc16kermit(0:14)
CRC-16/MODBUScrc16modbus(0:14)0crc16modbus(0:14)1crc16modbus(0:14)
CRC-16/X-25crc16x25(0:14)0crc16x25(0:14)1crc16x25(0:14)
CRC-16/XMODEMcrc16xmodem(0:14)0crc16xmodem(0:14)1crc16xmodem(0:14)

Works in mSniffer

The exprssion of last byte b15 is crc8, and the results are calculated correctly in a second.

Leave a Reply

Your email address will not be published. Required fields are marked *

0
    Your Cart
    Your cart is emptyReturn to Shop