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
-1
votes
1 answer

What is better crc8 or crc16?

I’m very interested on the crc topic. I understand that the probability of the error with a crc8 is 1/256, a 0.39%. But I want to know the number of bits that could change in an amount like 320 bytes. This error is about an amount of bits or using…
Kikecea
  • 11
-1
votes
1 answer

How to reverse the output of crc.crc16ccitt to the original input?

How to reverse the output of crc.crc16ccitt to the original input. Used npm module named crc. Package used: https://github.com/alexgorbatchev/crc Method used: crc.crc16ccitt(inputString)
Easwaramoorthy Kanagaraj
  • 3,925
  • 8
  • 36
  • 62
-1
votes
1 answer

CRC-16 SQL CCTI

I have Sql Code that converts input to CRC-32 Need help to convert CRC-32 to CRC-16 is there any other resource available. below is my SQl Please help I need 4 digit output code DECLARE @input VARCHAR(50) SET @input =…
Asif Ali
  • 9
  • 1
-1
votes
1 answer

CRC16 CCITT Java implementation

There is a function written in C that calculates CRC16 CCITT. It helps reading data from RFID reader - and basically works fine. I would like to write a function in Java that would do similar thing. I tried online converter page to do this, but the…
bzc0fq
  • 579
  • 1
  • 3
  • 18
-1
votes
1 answer

CRC16 with hex long array Data type java

I am trying to get right CRC16 with using the following code, public static int GenCrc16(final byte[] buffer) { int crc = 0xffff; for (int j = 0; j < buffer.length ; j++) { crc = ((crc >>> 8) | (crc << 8) )& 0xffff; crc ^=…
-1
votes
1 answer

Calculation of CRC-16(0xFFFF)

I have data of 18005 hexadecimal frames, and I want to calculate crc-16(0xffff) of all frames simultaneously and then append.
-1
votes
2 answers

What does mask variable do in this CRC checksum calculation?

The question is about code in figure 14-6 in here. The mask is calculated as: mask = -(crc & 1) Why do we & crc with 1 and then make result negative? The Figure 14-5 does not have this mask variable, why? Edit: So since this point is clear, why do…
quantum231
  • 2,420
  • 3
  • 31
  • 53
-1
votes
1 answer

Converting CRC16 calculation from C to C#

I have to translate a CRC16 calculation from C to C# but get the message that I cannot implicitly convert type 'int' to 'bool' on the (crc & 0x8000) and on return (crc & 0xFFFF) The code so far: public unsafe short Crc16(string str) { short crc…
user5825579
  • 105
  • 3
  • 15
-1
votes
2 answers

Checksum CRC 16 from C++ to Java

I have source with checksum CRC16 in C++: quint16 MainWindow::calculateCRC16(QByteArray buffer) { quint16 newCrc; quint8 i; newCrc = 0xFFFF; for(i = 0; i < buffer.size(); i++){ newCrc = this->crc16_update(newCrc,…
ronin
  • 11
  • 1
-1
votes
1 answer

Crc16 To String

I can convert string to crc16 but I need convert crc16 to string.Is it possible? function TForm1.CRC_16(Icerik: string): word; var valuehex: word; i: integer; CRC: word; Begin CRC := 0; for i := 1 to length(Icerik) do begin valuehex…
-1
votes
1 answer

Delphi to Java porting issue

I'm aware that java byte is a 8 bits signed variable and to get unsigned (byte) values I will have to do the masking with 0xff everywhere. Java documentation also says that I can use int to generate unsigned bits by using the procedure previously…
Machado
  • 14,105
  • 13
  • 56
  • 97
-2
votes
1 answer

16 bit Checksum fuzzy analsysis - Leveraging "collisions", biases a thing?

If playing around with CRC RevEng fails, what next? That is the gist of my question. I am trying to learn more how to think for myself, not just looking for an answer 1 time to 1 problem. Assuming the following: 1.) You have full control of white…
JOULTICOA
  • 21
  • 6
-2
votes
2 answers

different crc16 C and Python3?

I have two crc16 calculators (in C and in Python). But Im receiving different results. Why? calculator in C: unsigned short __update_crc16 (unsigned char data, unsigned short crc16) { unsigned short t; crc16 ^= data; t = (crc16 ^ (crc16 << 4))…
Vit Amin
  • 574
  • 5
  • 20
-2
votes
1 answer

How to adjust the reconcilation factor calculation for a CRC32 to a CRC16?

In my Project i need to append one byte to a data buffer. If I add this extra byte this would cause a change of the crc checksum. In order to prevent a change I have to calculate a reconcilation factor which is appended to the end of the data. The…
Philipp Fu
  • 75
  • 1
  • 6
-2
votes
1 answer

Convert String to Hex in Java

I want using CRC16, but first, i want to convert string to hex. because integer must be 16 bytes. i still confused to encrypt using CRC16. this is my code. public static void main(String[] args) { String input = "skn"; …
1 2 3
21
22