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

fix: adler32's first 16-bit should default to 1 not 0 #294

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

Bilal2453
Copy link
Contributor

@Bilal2453 Bilal2453 commented Aug 20, 2024

Using the default value for the first parameter of lminiz.adler32 will output invalid checksum due to improper defaults.

For example:

local miniz = requrie("miniz")
miniz.adler32(nil, "luvit") --> 110625332

Which is wrong, it should instead be 110953013 (0x069D0235).
For reference take the output of an online calculatore like this one or even the Wikipedia example.

An Adler32 checksum is 32-bit number made of two 16-bit groups A and B, group A should initiate with 1 and group B should initiate with 0. Currently by default group A will default to 0 instead of 1.

@zhaozg Is this right?

@Bilal2453
Copy link
Contributor Author

Failed tests are unrelated.
@truemedian Seems like the QEMU-based tests are failing due to a fetching error (404).

@zhaozg zhaozg merged commit eb1d7c9 into luvit:master Aug 20, 2024
43 of 51 checks passed
@Bilal2453 Bilal2453 deleted the lminiz-adler32-default branch August 20, 2024 10:12
This pull request was closed.
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

Successfully merging this pull request may close these issues.

2 participants