help with exFat checksum

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Hi freaks, I have the following checksum function, I've tried passing various structs to it to get it to return the correct value but thus far I have failed.  The function is listed below:

 

 

Any input is very, very greatly appreciated.

 

Examples of tests:

 

 

 

This topic has a solution.
Last Edited: Tue. May 7, 2019 - 12:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


And this is the CheckSum function.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Think I have it.  Plus the checksum function was wrong, it was not updating the Octlets++ when it continued.

 

EDITED : still not returning the correct data.

Last Edited: Sat. May 4, 2019 - 05:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Passing pointers to structs might be the problem in that the compiler may pad the structure members to fall on a word boundary.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Struct size 32 bytes.  Should be fine?

I tried recursing through the for loop in the CheckSum function to see if it ever hits th target value that I'm expecting.

Last Edited: Sat. May 4, 2019 - 05:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Add printf to see the bytes being actually used in the checksum.

Rather than *Octets, you could use Octets (index) and not require the *Octets++
Note the website eats square brackets, so i used round ones.

Last Edited: Sat. May 4, 2019 - 05:26 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Okay lads, does anyone want to help me crunch the numbers.

 

The TARGET is 435, see the 2 - 3 values.  These values are skipped by the checksum,  There are three 32 bit structs.

 

// First 32 bytes

85 2 43 5 10 0 0 0 ba 98 a4 4e ba 98 a4 4e ba 98 a4 4e 55 55 84 84 84 0 0 0 0 0

0 0

 

// Second 32 bytes

c0 3 0 a 4e ca 0 0 0 80 0 0 0 0 0 0 0 0 0 0 b 0 0 0 0 80 0 0 0 0 0 0

 

// Third 32 bytes

c1 0 4e 0 65 0 77 0 20 0 66 0 6f 0 6c 0 64 0 65 0 72 0 0 0 0 0 0 0 0 0 0 0

 

The function is 

 

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For anyone interested, the Enrty Check Sum covers the entire entry including the stream and filename.

the filename hash is the entry name UPPER CASE with padding between.