Need Help with CRC16

Hi good day; I want to see the possibility that if someone can help me gene rate a crc calculator from txt files, I have a text file, and the result of the crc by which it must be submitted I already have, but I don't know how to get to He actually has several files to do the test, but I couldn't get to those results; Can someone help me?

Reply to
Miguel Angel Palos M
Loading thread data ...

nerate a crc calculator from txt files, I have a text file, and the result of the crc by which it must be submitted I already have, but I don't know h ow to get to He actually has several files to do the test, but I couldn't g et to those results; Can someone help me?

What is in the text file, the data you need to calculate the CRC16 on?

Are you coding this in some particular language? Can you give us some deta ils?

--
  Rick C. 

  - Get 1,000 miles of free Supercharging 
 Click to see the full signature
Reply to
Rick C

generate a crc calculator from txt files, I have a text file, and the resul t of the crc by which it must be submitted I already have, but I don't know how to get to He actually has several files to do the test, but I couldn't get to those results; Can someone help me?

ails?

Sure, the File is attached; I have a program that checks the value of the c rc that is in the first line against the crc that gives the checksum of the file; so my purpose is to figure out how to modify the file and obviously put the new crc on the first line.

I do not know if I explained well?

--------------------Filetext begins----------- E48D

8 1 1 1 400 8888 TH86 9 8 7 6 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 100 0 0 0 1 0 1 0 0 0 0 0 0 0 2 0 1 1 2 2 2 4 4 4 3 120 6 1 20 1 55 200 1 999 1 999 0 0 0 0 0 300 1 999 1 999 0 0 0 0 0 3000 1 9000 1 9999 0 0 0 0 0 0 0 0 0 0 200 20 999 1 999 200 20 999 1 999 300 1 999 1 999 0 0 0 0 0 200 1 999 1 999 200 1 999 1 999 654 FALSE -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 TRUE 5 FIXED XRAYS 1 500 400 0 0 NA 0 500 33 33 33 33 654 250 250 FIXED XRAYS 1 100 80 0 0 NA 0 100 33 33 33 33 654 250 250 FIXED XRAYS 1 100 80 0 0 NA 0 100 33 33 33 33 654 250 250 ARC XRAYS 1 180 96 1800 2700 NA 0 180 33 33 33 33 654 100 100 ARC XRAYS 1 90 53 2700 1800 NA 0 90 33 33 33 33 654 100 100

--------------------------file text end-----------------------------

Reply to
Miguel Angel Palos M

Do you have any documentation or information about the file format or the way the CRC is calculated?

As I see it, there are two key challenges. First, there are a large number of variations as to what "CRC16" could mean. The Wikipedia article can give you some idea - there are lots of suitable polynomials for 16-bit CRC's, you can have any starting value, there can be bit reversals, byte reversals, and other variations.

The biggest question, I think, is knowing what part of the file the CRC is run over, and in what way. Obviously the first line is not part of the checksummed data, since it contains the CRC. Which other parts are omitted? Are the numbers used directly as 16-bit values? Are ASCII characters used as the data? Is white space skipped or included? Line endings?

No one here can tell you (unless someone happens to recognize the file format). Trying to figure out the variation used by guesswork and trial and error is going to be a lot of effort.

Reply to
David Brown

Why don't you ask "him" for clarification?

Reply to
Don Y

esult

ow

n't

To this day I already know the polynomial of the crc16, any other idea of ??how to obtain the other data that I lack to calculate the data of the crc?

Reply to
Miguel Angel Palos M

On Wednesday, July 29, 2020 at 7:46:30 PM UTC-4, Miguel Angel Palos M wrote :

e

result

know

ldn't

??how to obtain the other data that I lack to calculate th e data of the crc?

I thought that was all you needed???

--
  Rick C. 

  -++ Get 1,000 miles of free Supercharging 
 Click to see the full signature
Reply to
Rick C

Why don't you ask "him" for clarification?

Reply to
Don Y

In the Internet RFC 1662 part C, there is a pretty general example of calculating CRCs. The PPP polynomial is different from the IBM CRC-16, but the algorithm is valid for it, too, if the polynomial is adjusted in a suitable way.

--

-TV
Reply to
Tauno Voipio

At least, you need the initial value of the generator and which way the bits are processed, most significant end first or least significant end first.

If you have many examples, the initial value can be deduced, but it would be better to know it. Often all ones (0xffff) are used, to prevent initial null bytes of the message being ignored. Sometimes the final value is inverted.

The example text file cannot be reliably used to check, as its whitespace can be transformed during transfers through the NNTP protocol.

--

-TV
Reply to
Tauno Voipio

You also don't know if the CRC is calculated over the actual text file

*or* if the text file is a pretty-printed version of the data (stored in some not defined encoding) that the checksum protects.

Are line terminations CRs? LFs? CRFLs?

Sure seems like the *source* of the file would be best equipped to indicate what the "rules" are!

Reply to
Don Y
:
e

result

know

ldn't

of ??how to obtain the other data that I lack to calculate the data of the crc?

Mr Tauno Voipio

I have many examples of +10 files with the crc in the header which is what it should give and all in TXT format, the detail is that I have not even fo und what you are commenting on and it makes itself look so easy.

----physics.txt------- E48D

8 1 1 1 400 8888 TH86 9 8 7 6 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 100 0 0 0 1 0 1 0 0 0 0 0 0 0 2 0 1 1 2 2 2 4 4 4 3 120 6 1 20 1 55 200 1 999 1 999 0 0 0 0 0 300 1 999 1 999 0 0 0 0 0 3000 1 9000 1 9999 0 0 0 0 0 0 0 0 0 0 200 20 999 1 999 200 20 999 1 999 300 1 999 1 999 0 0 0 0 0 200 1 999 1 999 200 1 999 1 999 654 FALSE -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 TRUE 5 FIXED XRAYS 1 500 400 0 0 NA 0 500 33 33 33 33 654 250 250 FIXED XRAYS 1 100 80 0 0 NA 0 100 33 33 33 33 654 250 250 FIXED XRAYS 1 100 80 0 0 NA 0 100 33 33 33 33 654 250 250 ARC XRAYS 1 180 96 1800 2700 NA 0 180 33 33 33 33 654 100 100 ARC XRAYS 1 90 53 2700 1800 NA 0 90 33 33 33 33 654 100 100

----physics.txt----ends

-----service.txt----- EB78 7 0 0 100 5 200 11 200 0 200 7 200 5 300 14 462 5 442 3 -100 -3 -100 -3 -100 -3 -100 -3 -100 -4 -100 -3 0 0 300 -2 -1500 -3 2100 1 0 0 -6 0 76 0 125 0 -300 -14 500 40 200 5 200 8 510 77 100 0 0 0 0 0 -1500 600 100 0 100 0 100 0 100 0 100 -1 100 0 100 0 100 0 100 0 100 0 100 0 200 0 200 0 205 0 200 0 210 0 195 0 300 0 100 0 100 0 100 0 100 0 100 0 300 0 100 0 100 0 100 0 100 0 0 0 0 0 0 0 0 0 100 0 3650 -50 180 409 40 2048 -52 21 1024 1024 16 7197 -32293 0 7194 -32290 0 2750 850 200 409 512 12288 -52 32 1024 1024 16 7214 18905 0 0 0 0 201 -105 40 615 885 4096 52 0 1024 1024 6 6 -4117 857 4 4095 1481 201 -105 40 615 885 4096 52 0 1024 1024 6 -5 -4098 482 -15 4125 586 201 -20 40 615 864 8192 52 0 1024 1024 6 366 1827 -406 0 0 0 201 -20 40 615 864 8192 52 0 1024 1024 6 348 1805 -285 0 0 0 1675 595 64 307 200 0 -52 32 2047 102 8 4646 9594 0 0 0 0 1250 750 160 307 180 16384 52 40 683 300 8 4009 4211 0 0 0 0 1540 0 160 307 200 8192 52 40 683 400 8 3185 12886 0 0 0 0 2750 850 96 624 128 12288 -52 32 500 500 8 7190 -20251 0 0 0 0 402 5 40 615 0 0 52 0 1024 1024 1 0 0 0 0 0 0 402 5 60 615 384 0 52 0 1024 1024 8 737 3683 439 0 0 0 32 20 20 30 100 842 6 -8 0 8196 800 256 0 0 0 3640 800 0 0 4096 3640 800 0 0 4096 2400 630 0 0 1280 2400 800 0 0 1280 2500 400 0 0 0 1200 120 0 0 12288 1000 110 0 0 10496 1700 50 0 0 18176 28 120 20 100 6 20 6 20 6 20 6 20 6 100 6 100 6 100 20 120 5 0 900 1800 2700 3600 0 5 900 1350 1800 2250 2700 0 6 -90 -40 20 80 140 190 6 -90 -40 20 80 140 190 5 -20 20 80 140 190 0 5 -20 20 80 140 190 0 6 650 800 1000 1200 1400 1600 5 770 875 1000 1125 1230 0 6 0 300 600 900 1200 1500 5 900 1350 1800 2250 2700 0 0 0 0 0 0 0 0 5 20 100 200 300 380 0 255 0 1 1 1 2 3 4 5 6 6 7 8 9 10 11 12 12 13 13 14 14 15 15 16 16 17 18 19 20 21 22 23 23 25 28 32 36 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40

---------service.txt---ends-------

Reply to
Miguel Angel Palos M

ce can

In fact, when modifying even a blank space the program that validates the c rc, marks an error; if you take into account the blank spaces.

The Line terminations are a new line /n

the source files are published, and the rest is an executable (exe) that only verifies it and then executes .

Reply to
Miguel Angel Palos M

El jueves, 30 de julio de 2020 a las 8:40:53 UTC-5, Miguel Angel Palos M es

?:

me

he result

t know

ouldn't

a of ??how to obtain the other data that I lack to calculat e the data of the crc?

t

l.

t it should give and all in TXT format, the detail is that I have not even found what you are commenting on and it makes itself look so easy.

The First Line in each file are the crc that should be.

Reply to
Miguel Angel Palos M

A bit of web searching will find sample code to do CRC16 for various processors.

--
mdfs.net/Info/Comp/Comms/CRC16.htm
Reply to
jgh

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.