Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a 4428472 byte-long file. I want my program to be able to figure out the Sum32 checksum for all the bytes from offset 28 onwards.
The code I'm using to read the file is:
C#
System.IO.File.ReadAllBytes(filename)

This is a winforms application.
Thanks.

EDIT: This program is basically going to take user input, and according to that input, is simply going to write an 0x01 at specified offset(one of them is offset 1276), because this file has been edited, the checksum is no longer valid, so, I need to figure out how to generate this checksum, which I'm stuck on.
Posted
Updated 12-Sep-13 22:23pm
v2
Comments
OriginalGriff 13-Sep-13 4:13am    
And?
You have read the file, but what have you done with it to generate your checksum?
Please, show us what you have tried, and where you are stuck.
Miztah Raza 13-Sep-13 4:23am    
That's actually where I'm stuck. At generating the checksum, I've tried googling for information on fixing Sum32Checksums, but I've not been successful. The only thing I know is that the file I'm working with needs to have Sum32 checksum fixed in order to be a valid save file(this is for a game). The hex editor HxD has this function built-in. I've also edited the original question to provide more information about what my program does and why it needs the checksum fixed. Thanks

1 solution

Basically you have two options.
  • (the lucky one) if you can get relevant info on the exact algorithm used for the checksum then find its source code or implement it yourself.
  • (the not-so-lucky-one) Try (that is obtain or code yourself) different 'checksum 32' algorithms (e.g. the Fletcher-32) and compare their results with the one you have.
 
Share this answer
 
Comments
Miztah Raza 13-Sep-13 4:58am    
Alright, thanks, dude.
CPallini 13-Sep-13 5:31am    
You are welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900