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

Use crc32b instead of crc32 #468

Merged
merged 2 commits into from
Aug 30, 2023
Merged

Use crc32b instead of crc32 #468

merged 2 commits into from
Aug 30, 2023

Conversation

marzvrover
Copy link
Contributor

@marzvrover marzvrover commented Aug 29, 2023

TLDR

php is interesting: this change makes it easier to validate the checksum in different langauges by using the IEEE CRC32 polynomial

Reason for Change

So when implementing the validator for the checksum I noticed that PHP actually has a rich history with CRC32.

The crc32() method uses the IEEE polynomial that's become the defacto standard, but the hash('crc32'…) method uses a different polynomial that then becomes more difficult to validate in languages other than php. The hash() method calls the algorithm crc32b when you want to use the IEEE polynomial.

After working away on this issue in golang for awhile, I realized it would be better for the community to update it to the more universal polynomial.

After this change the one last thing to watchout for with this is that php reverses the crc32 byteorder compared to most other languages, but that can easily be overcome in the validator.

@taylorotwell taylorotwell merged commit a24affa into laravel:3.x Aug 30, 2023
7 checks passed
@taylorotwell
Copy link
Member

Thanks!

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