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
3
votes
2 answers

Translating a CRC algorithm from C to Java

I have the below code which I am trying to convert to Java. WORD ComputeCRC16(BYTE *data, DWORD data_length) { BYTE *ptr; BYTEWORD retval; /* Initialize the CRC */ retval.w = 0xFFFF; /* Iterate through the data */ for…
AnOldSoul
  • 4,017
  • 12
  • 57
  • 118
3
votes
1 answer

CRC-CCITT (Kermit)

I am analyzing a feed from a GPS which uses CRC-CCITT16 (Kermit) for the below message Message From GPS Device: (byte) 0x3,(byte) 0xfb,(byte) 0x0,(byte) 0x3,(byte) 0x13,(byte) 0x61,(byte) 0x2d,(byte) 0x5f,(byte) 0xc0,(byte) 0xa,(byte) 0x1,(byte)…
Dineshkumar
  • 294
  • 1
  • 6
  • 19
3
votes
4 answers

C CRC Calculation method rewritten in Python seems wrong

Note: CRC16 in Python topic does not solve my problem. Deploying python package into server is restricted. Also my need is not a library to implement, I already wrote a function for this. My need is just correcting my function. I need to implement…
Sencer H.
  • 1,201
  • 1
  • 13
  • 35
3
votes
3 answers

Unknown CRC Calculation

I'm trying to reverse engineer the communication protocol from an old serial device. I've figured out most of it, but am stuck on the CRC algorithm used. I have host software that I can generate request messages, so I've included a dump of…
spanky
  • 151
  • 10
3
votes
1 answer

How do you figure out the values of a lookup table based on the CRC polynomial?

In this code http://introcs.cs.princeton.edu/java/51data/CRC16.java, the program uses a lookup table based on the crc polynomial 1 + x^2 + x^15 + x^16. My question is how do you figure out the values of the lookup table based on the crc polynomial.…
zeni
  • 31
  • 2
3
votes
1 answer

Need help in correcting issues in CRC-ITU check method written in java

We are trying to code GPS device listener on Java. While doing this, we are unable to develop the right Code for the CRC-ITU error check. The explanation for the crc code generation from protocol document is as below A check code may be used by the…
3
votes
4 answers

Calculation of CCITT standard CRC with polynomial x^16 + x^12 + x^5 + 1 in Java

I need help with calculating of CCITT standard CRC with polynomial x^16 + x^12 + x^5 + 1 (0x1081) in Java. I have tried many examples on the internet but every one of them returns other values than the ones in the example. For example for this array…
AdrianES
  • 670
  • 3
  • 13
  • 29
3
votes
2 answers

CRC 16 program to calculate check sum

I'm currently writing a CRC16 program which computes the CRC of characters using the CRC 16 polynomial X^16 + X^15 + X^2 + 1. the program should read data from the standard input and output the 16 bit CRC in hexadecimal. Nonetheless, when I execute…
zer0
  • 33
  • 1
  • 1
  • 5
3
votes
2 answers

What the lack of CRC-CCITT (0xFFFF)?

Based Online CRC calculation, when I entered hex string data = 503002080000024400003886030400000000010100 I get result CRC-CCITT (0xFFFF) = 0x354E (Expected Result) . I use the code below, but the results of CalcCRC16() are 0xACEE. What the…
new bie
  • 2,745
  • 6
  • 24
  • 26
3
votes
2 answers

Implement CRC algorithm from equation

I'm dealing with a device which say to use this 16 bit cyclic redundancy check: CCITT CRC-16 with polynomial x^16 + x^12 + x^5 + x^1 I looked for an implementation of such algorithm, but I did find only ones with the last term of the equation equal…
etuardu
  • 5,066
  • 3
  • 46
  • 58
3
votes
4 answers

Problems converting CRC16 function from C to JAVA without unsigned int

I have to create a CRC16 checksum for a firmware update. When I send this Data (converted from hex-string to byte[]) 020000810000120000000002F001128100000C9462050C9481050C9481050C9481050C9481050C9481050C9481050C9481050C9481050C9481050C9481050C94 I…
it-west.net
  • 383
  • 1
  • 4
  • 8
3
votes
2 answers

PHP Hex and Binary

I have a string in the following format: "0A1344010400010005" (hex representation) I would need to convert this string into an array of bytes (0x0a, 0x13, 0x44, and so forth) so that these data can be used in the following function: $data =…
Heru S
  • 1,283
  • 2
  • 17
  • 28
2
votes
1 answer

Reverse CRC16 calculation

I'm trying to understand how is calculated the CRC at the end of a radio packet. Here are a few examples: 11 00 01 0D 30 10 05 1F 11 ED 7E 01 00 01 B9 33 11 00 01 0D 30 10 05 1F 11 ED 7E 01 00 00 B9 32 11 00 01 1D 30 10 05 1F 11 ED 7E 01 00 00 EA…
Guillaume
  • 33
  • 5
2
votes
2 answers

CRC-16 Checksum calculator with Vanilla JS

I am looking for a CRC-16 CRC algorithm which is written in JavaScript and runs in a normal browser. I know there are an incredible amount of code examples for CRC-16 implementations in all sorts of programming languages. But still I could not solve…
Elohim89
  • 21
  • 1
  • 2
2
votes
3 answers

How Unique is CRC16 Value?

I'm developing an OpenSource .NET Licensing Engine. This engine use hardware id (harddisk serial number) as lock and CRC16 this value to get shorten identifier. Example value is MAXTOR ST3100, 476300BE and CRC16 result is 3FF0 My concern is how…
F8R
  • 61
  • 2
  • 7