Author Topic: Figure out checksum/CRC in a configuration file  (Read 1244 times)

0 Members and 1 Guest are viewing this topic.

Offline Staffan321Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Figure out checksum/CRC in a configuration file
« on: March 01, 2020, 02:48:18 pm »
Hello,

I have a test instrument (Wiltron 37247 Vector Network Analyzer) running a VME board MVME-162. It stores configurations files on either floppy or internal harddisk. I would like to modify these configuration files, but run into trouble from what I believe is CRC in the files. In some locations, I have identified fairly straightforward checksums being sums of bytes that are easy enough to handle, but in some locations, even a very small change in the configuration file seems to change the values in an unpredictable way (i.e., not just a sum). So, I guess there is some kind of CRC number there. Possibly something the programmers  responsible for one part of the file added in their own way.
Question is: given that I know what has changed between two files, is there any way of figuring out what CRC has been used? The result is a 16 bit word, but apart from that, I know very little what set of data is checked. I only know what has changed between two different files for example.

It's not very easy to generate arbitrary config files for checking, unfortunately. Any hints would be much appreciated!

Regards,
  Staffan
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 7314
  • Country: va
Re: Figure out checksum/CRC in a configuration file
« Reply #1 on: March 01, 2020, 05:42:26 pm »
There are standard CRCs and it's likely that one of these will have been used. Easy enough to check if you know the range of checked data (that is, the start and end locations).  For 16 bits, try:

http://srecord.sourceforge.net/crc16-ccitt.html

Edit: for speed and simplicity a lookup table is often used, but the longhand way might be more appropriate when messing about.
« Last Edit: March 01, 2020, 05:45:33 pm by dunkemhigh »
 

Offline Staffan321Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Re: Figure out checksum/CRC in a configuration file
« Reply #2 on: March 05, 2020, 06:36:09 am »
Thanks, will check.
My problem at the moment is that I have very few clues as to where the count starts and ends. One brute force way could be to vary the start point and check if/when the calculated crc matches the target. If there is any other (bit more clever) way, I’d love to hear!

Regards,
 Staffan
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 7314
  • Country: va
Re: Figure out checksum/CRC in a configuration file
« Reply #3 on: March 05, 2020, 11:43:14 am »
Tricky. If you're sure you have the checksum identified, start at the beginning of the file and change a byte until the checksum also changes, then you are fairly sure of where it starts. Likely ends the byte before the sum, but the same process backwards would confirm that. Having figured where the start and end is, try and figure the actual summing technique. The same checksumming method can give different answers depending on whether the calculated sum is stored, or whether some value that added to the sum gives a go/no-go value. On the plus side, anything doing that likely follows some well-known standard to the letter so there are only a couple of variations to check :)
 

Offline Staffan321Topic starter

  • Regular Contributor
  • *
  • Posts: 51
Re: Figure out checksum/CRC in a configuration file
« Reply #4 on: March 06, 2020, 06:38:31 am »
Hello,
The procedure sounds straightforward and I’m considering to do just that. Only problem is that the instrument only reads from floppies and a 180k file -is- big then :-(
I would have to generate a set of files where I change the data ( not CRC) and see when the read fails. Possible problem is that the file is split in sections and there may be ’holes’ inbetween that is not considered.
Anyways, this way is perhaps the safest to go forward with. Just need to find a suitable week and heaps of coffee. The latter is no problem at least.
Regards,
 Staffan
 

Offline SethGI

  • Regular Contributor
  • *
  • Posts: 51
  • Country: us
Re: Figure out checksum/CRC in a configuration file
« Reply #5 on: April 05, 2020, 02:31:47 am »
Honestly, if you're trying to figure out what data they sent through CRC and have no idea where to look, email the manufacturer and ask. You may be pleasantly surprised.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf