EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Need Help with CRC16

Started by Miguel Angel Palos M July 27, 2020
Hi good day; I want to see the possibility that if someone can help me generate 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?
On Monday, July 27, 2020 at 3:55:00 PM UTC-4, Miguel Angel Palos M wrote:
> Hi good day; I want to see the possibility that if someone can help me generate 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?
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 details? -- Rick C. - Get 1,000 miles of free Supercharging - Tesla referral code - https://ts.la/richard11209
El lunes, 27 de julio de 2020 a las 20:45:25 UTC-5, Rick C escribió:
> On Monday, July 27, 2020 at 3:55:00 PM UTC-4, Miguel Angel Palos M wrote: > > Hi good day; I want to see the possibility that if someone can help me generate 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? > 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 details? > > -- > > Rick C. > > - Get 1,000 miles of free Supercharging > - Tesla referral code - https://ts.la/richard11209
Sure, the File is attached; I have a program that checks the value of the crc 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-----------------------------
On 28/07/2020 03:57, Miguel Angel Palos M wrote:
> El lunes, 27 de julio de 2020 a las 20:45:25 UTC-5, Rick C escribió: >> On Monday, July 27, 2020 at 3:55:00 PM UTC-4, Miguel Angel Palos M >> wrote: >>> Hi good day; I want to see the possibility that if someone can >>> help me generate 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? >> 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 details? >> >> -- >> >> Rick C. >> >> - Get 1,000 miles of free Supercharging - Tesla referral code - >> https://ts.la/richard11209 > > > > > > > Sure, the File is attached; I have a program that checks the value of > the crc 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? > >
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. <https://en.wikipedia.org/wiki/Cyclic_redundancy_check> 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.
On 7/27/2020 12:54 PM, Miguel Angel Palos M wrote:
> Hi good day; I want to see the possibility that if someone can help me > generate 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?
Why don't you ask "him" for clarification?
El martes, 28 de julio de 2020 a las 3:01:09 UTC-5, Don Y escribi&oacute;:
> On 7/27/2020 12:54 PM, Miguel Angel Palos M wrote: > > Hi good day; I want to see the possibility that if someone can help me > > generate 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? > Why don't you ask "him" for clarification?
To this day I already know the polynomial of the crc16, any other idea of &#8203;&#8203;how to obtain the other data that I lack to calculate the data of the crc?
On Wednesday, July 29, 2020 at 7:46:30 PM UTC-4, Miguel Angel Palos M wrote:
> El martes, 28 de julio de 2020 a las 3:01:09 UTC-5, Don Y escribi&oacute;: > > On 7/27/2020 12:54 PM, Miguel Angel Palos M wrote: > > > Hi good day; I want to see the possibility that if someone can help me > > > generate 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? > > Why don't you ask "him" for clarification? > > > To this day I already know the polynomial of the crc16, any other idea of &#8203;&#8203;how to obtain the other data that I lack to calculate the data of the crc?
I thought that was all you needed??? -- Rick C. -++ Get 1,000 miles of free Supercharging -++ Tesla referral code - https://ts.la/richard11209
On 7/29/2020 4:46 PM, Miguel Angel Palos M wrote:
> El martes, 28 de julio de 2020 a las 3:01:09 UTC-5, Don Y escribi&oacute;: >> On 7/27/2020 12:54 PM, Miguel Angel Palos M wrote: >>> Hi good day; I want to see the possibility that if someone can help me >>> generate 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? >> Why don't you ask "him" for clarification? > > To this day I already know the polynomial of the crc16, any other idea of &#8203;&#8203; > how to obtain the other data that I lack to calculate the data of the crc?
Why don't you ask "him" for clarification?
On 30.7.20 2.46, Miguel Angel Palos M wrote:
> El martes, 28 de julio de 2020 a las 3:01:09 UTC-5, Don Y escribi&oacute;: >> On 7/27/2020 12:54 PM, Miguel Angel Palos M wrote: >>> Hi good day; I want to see the possibility that if someone can help me >>> generate 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? >> Why don't you ask "him" for clarification? > > > To this day I already know the polynomial of the crc16, any other idea of &#8203;&#8203;how to obtain the other data that I lack to calculate the data of the crc?
In the Internet RFC 1662 <https://tools.ietf.org/html/rfc1662> 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
On 30.7.20 2.46, Miguel Angel Palos M wrote:
> El martes, 28 de julio de 2020 a las 3:01:09 UTC-5, Don Y escribi&oacute;: >> On 7/27/2020 12:54 PM, Miguel Angel Palos M wrote: >>> Hi good day; I want to see the possibility that if someone can help me >>> generate 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? >> Why don't you ask "him" for clarification? > > > To this day I already know the polynomial of the crc16, any other idea of &#8203;&#8203;how to obtain the other data that I lack to calculate the data of the crc?
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

The 2024 Embedded Online Conference