Questions tagged [crc16]

CRC16 is a 16-bit Cyclic Redundancy Check code, used mainly as an error detection method during data transmission.

A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data. Blocks of data entering these systems get a short check value attached, based on the remainder of a polynomial division of their contents; on retrieval the calculation is repeated, and corrective action can be taken against presumed data corruption if the check values do not match. Because the check value has a fixed length, the function that generates it is occasionally used as a hash function.wikipedia

The most commonly used polynomial lengths are:

  • CRC-8: 9 bits
  • CRC-16: 17 bits
  • CRC-32: 33 bits
  • CRC-64: 65 bits

A truly excellent tutorial on CRC's is Ross Williams' "Painless Guide to CRC Detection Algorithms", which can also be found here, here, here, here, and here.

323 questions
6
votes
4 answers

crc16 implementation java

I am having problems with calculating CRC-16 implementation of a byte array in java. Basically I am trying to send bytes to a RFID that starts writing to a tag. I can see the checksum value of array by looking tcpdump command on mac. But my goal is…
Ali Yucel Akgul
  • 1,101
  • 8
  • 27
  • 53
5
votes
3 answers

CCITT CRC 16 Bit Start Value 0xffff

I need to calculate a CCITT 16 bit checksum value for data passed as a parameter together with the length. If I fill my array TempStr with the test data "123456789", use the polynomial 0x8408 with the length excluding the null termination character,…
Ruaan Volschenk
  • 717
  • 2
  • 11
  • 23
5
votes
2 answers

CRC16 ISO 13239 Implementation

i'm trying to implement Crc16 in C#. I already tried many different implementations, but most of them gives me different values. Here are some of the codes that i already used. private static int POLYNOMIAL = 0x8408; private static int…
Fabio Reis
  • 95
  • 1
  • 2
  • 11
4
votes
1 answer

How to check CRC16 validity

I'm working on receiving binary data from sensors for the first time. The data is base64-encoded, I should decode the data and validate it and then save it to the database. One step of the validation process is to check for the CRC-16 validity. Each…
Furqan S. Mahmoud
  • 1,417
  • 2
  • 13
  • 26
4
votes
1 answer

Why does the CRC of "1" yield the generator polynomial itself?

While testing a CRC implementation, I noticed that the CRC of 0x01 usually (?) seems to be the polynomial itself. When trying to manually do the binary long division however, I keep ending up losing the leading "1" of the polynomial, e.g. with a…
David Schneider
  • 472
  • 5
  • 13
4
votes
0 answers

Swift 3 convert a string to a hex for Modbus CRC calculation

I have to calculate the CRC16 of a string, and have that example code: import Foundation enum CRCType { case MODBUS case ARC } func crc16(_ data: [UInt8], type: CRCType) -> UInt16? { if data.isEmpty { return nil } let polynomial:…
Hajado
  • 41
  • 3
4
votes
1 answer

How to calculate the CRC16 for wireless M-Bus messages

I try to calculate the CRC16 for m-bus messages in go. One example is in the following document on page 4: http://fastforward.ag/downloads/docu/FAST_EnergyCam-Protocol-wirelessMBUS.pdf 10 data bytes and the checksum (HEX): 1244C418641610230102…
Tarion
  • 16,283
  • 13
  • 71
  • 107
4
votes
0 answers

CRC 16 bit (Polynomial 0x1021) CCITT calculation with initial value 0x0000

Well I am scratching my head and very close to break it with hammer. I am trying to calculate CRC16 bit CCITT and it not giving me what its supposed to. I have searched almost everything and dont know what i am missing. This is the full packet with…
Crazy Engineer
  • 325
  • 5
  • 17
4
votes
0 answers

CRC16-CCITT (x.25) Checksum Calculation Problems

I have read about a helpful website with a CRC calculator covered in other posts, which works great, but the code provided in C language does not replicate the capabilities, unfortunately: http://www.zorc.breitbandkatze.de/crc.html The following…
KappaDragon
  • 61
  • 1
  • 6
4
votes
1 answer

Generic CRC (8/16/32/64) combine implementation

Old Title of this question : Difference between CRC16 combine implementation vs CRC32 combine Implementation I am trying to implement CRC16 combine implementation similar to CRC32 combine implementation. I am using CRC-CCITT (Initial : 0xFFFF, Poly…
killer
  • 121
  • 1
  • 10
4
votes
0 answers

ZMODEM CRC-32 FCS Issues

I found many questions and answers on this topic. But I still stuck with ZModem stuff. I'm stuck with CRC-32 stuff at the end of the frame (FCS). I wanted to know on which part of the ZFile header frame is calculated this checksum? Is the…
Milz
  • 41
  • 3
4
votes
1 answer

How to configure calculation of CRC table

There are a lot of CRC calculation examples out there. Simple implementations with bit shifting and more efficient with a pre-calculated table. But there are also a lot of Parameters of a CRC beside the polynomial that affect the calculation. You…
harper
  • 13,345
  • 8
  • 56
  • 105
4
votes
1 answer

How to get a CCITT-CRC16 on Python's crcmod lybrary?

I'm having problems to make a code in Python 3.4 using the CRCMOD library to get the CCITT CRC16 check. Thats my…
SnowBG
  • 89
  • 1
  • 2
  • 12
4
votes
5 answers

CRC-CCITT to CRC16 Modbus implementation

I am having a lot of trouble on generating a modbus CRC16 code using PHP. I have found a lot of different codes over the internet but i have tried them and for some reason i didnt get right results. I have found a PHP code for generating…
JotaTRod
  • 91
  • 2
  • 7
4
votes
3 answers

ISO/IEC13239 CRC16 Implementation

I need a CRC16 implementation for NFC Tags. As the standard tolds me this is ISO/IEC13239 and a sample C code is provided. I translated this code into Java but it gives me wrong results: private static final char POLYNOMIAL = 0x8404; private static…
reox
  • 5,036
  • 11
  • 53
  • 98
1
2
3
21 22