Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checksum calculation algorithm #2

Open
SerhiiKalita opened this issue Apr 7, 2024 · 2 comments
Open

checksum calculation algorithm #2

SerhiiKalita opened this issue Apr 7, 2024 · 2 comments

Comments

@SerhiiKalita
Copy link

can you provide the checksum calculation algorithm?

@kimikage
Copy link

kimikage commented Apr 7, 2024

Although there is some ambiguity there, it is as stated in the specifications.

To add to the description in the specification, what is summed is not the decoded bitmap, but the encoded byte sequence.
Also, the checksum code is recorded as a complement. Therefore, the sum including the checksum code should be 0xff.

@JackDesBwa
Copy link

I had the same question. By testing different algorithms, it looks like this one works on the .goo file generated by Voxeldance Tango 4.0.15.04 (according to the headers) that I used for testing:

checksum = 0
for b in rle_data:                                                                                                                                          
  checksum = (checksum + b) & 0xff
checksum = (~checksum) & 0xff

i.e. bitwise NOT of the sum of the bytes of the RLE data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants