CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

crc calc.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

crc calc.
PostPosted: Tue Jan 24, 2023 7:13 am     Reply with quote

Hello all,

I'm trying to decode crc algorithm with this data:

Code:

"I1:8:00:00:5A99"
"I1:8:00:01:4341"


where "5A99" and "4341" are crc from 'I' to last ':'

Can anyone help?
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 24, 2023 7:36 am     Reply with quote

I'd go to whoever CREATED the 'line of data'. It appears to be 3 elements that are from something called 'I1' ??

The CRC is just a calculation that someone does on some data,usually to produce a 'checksum' to validate that data after transmitting it from 'here to there'. While you might be able to 'reverse engineer' it, having only 2 datasets probably isn't enough.

one possible way...
https://reveng.sourceforge.io/

2 data will produce 3 possible results
3 data should give 1 result

No, I've not used this program...
just curious...
Ttelmah



Joined: 11 Mar 2010
Posts: 19495

View user's profile Send private message

PostPosted: Tue Jan 24, 2023 8:22 am     Reply with quote

As Jay says, you need slightly more data to be sure of the results.
Also in fact, since you don't know if the source data is being treated as
ASCII, and including the colons, or ASCII without these, or as hex values,
you will have to try all these to possibly find a solution.
Problem is that for all the well known CRC formulae, there are hundreds
of other possibilities that 'may' exist. Normally a CRC is a polynomial
calculation, and you have the polynomial being used (dozens of possibilities),
and the seed value used to start (potentially for a 16bit equation up to
65536 possibilities). There are also though other calculations that could
be used, not employing the standard formulae.
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Tue Jan 24, 2023 9:29 am     Reply with quote

Hi,

I think data are treated as hex including colons and result is printed as ASCII, because I've decoding similar packet from the same device.

Okay,
Thanks for suggestion!
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 24, 2023 10:01 am     Reply with quote

'thinking' and KNOWING are different.
You can easily 'think' you have the CRC algorithm and 'think' that the data is good but you have to do a LOT of tests to confirm and KNOW it is correct.
Ttelmah



Joined: 11 Mar 2010
Posts: 19495

View user's profile Send private message

PostPosted: Tue Jan 24, 2023 10:48 am     Reply with quote

You can't treat it as 'hex including the colons', since a colon is not a hex
character. I suspect you mean as ASCII, so the sequence:
31 3A 38 3A 30 30 3A 30 30 3A
Doesn't give the 5A99 result from any of the standard CRC algorithms.
If you have 'decoded similar packets', then try the CRC algorithm you
used for these.

If this is coming from a 'device', then where is the data for this?. This
is what will tell you how the calculation is done. Wasting time otherwise.
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Tue Jan 24, 2023 12:23 pm     Reply with quote

* Yes mr. Ttelmah I mean ascii "31 3A 38 3A 30 30 3A 30 30 3A " Smile
* Yes I have tried 'standard' algorithms.

Because the data that is changing is only second pair "00" ("00" to "FF") I have made crc lookup table with 256 words.

For now this lookup tab. Will do the job that is required.

Thanks & Best Wishes,
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group