-1

I have implemented one TCP client-server module in C which process certain data. each server and client checking CRC32 value of packet before proceeding further. Here client and server running my PC and both are using same CRC algorithm.

Now one more 3rd party client connected to my server and sending data, but my server code failed to process data by rejecting that packet at CRC check step. CRC seems ok in this packet but what I see that 3rd party client uses input data as HEX to calculate CRC and our server uses CRC algorithm by considering input data as ASCII value. That's why i think it failed to process at server side as at both side different CRC value calculated base on what method followed.

So my question is that how to make general mechanism to handle all kind of client(no matter what CRC32 method followed)?

or is this type case possible in real time scenario?

user2520119
  • 173
  • 11
  • It depends on how large the polynomial is in relation to the possible data combinations. If you have for example a 16 bit CRC, then it allows for at most 2^16 = 65536 different data combinations. If you have more combinations than that, then you will of course have duplicates. – Lundin Dec 16 '20 at 12:39

1 Answers1

2

If you want the same CRC, two things have to be the same(a):

  • the algorithm used for the CRC; and
  • the data given to the algorithm.

The word pax and the word 716178 (the hex variant of pax, which is what you seem to be indicating your third party is using) are not the same data.


(a) You can technically get the same CRC even when the algorithm or data (or even both) are different, since it's a calculation that loses information - many inputs may map to an identical CRC. However, it's not very likely.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953