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

MD5 hash not matching #99

Open
theFra985 opened this issue Jun 15, 2023 · 3 comments
Open

MD5 hash not matching #99

theFra985 opened this issue Jun 15, 2023 · 3 comments

Comments

@theFra985
Copy link

theFra985 commented Jun 15, 2023

I've encountered weird behavior around MD5 hashes of post images.
On some images, the hash given by the API doesn't match the hash computed from the file downloaded from the CDN. (downloaded images open up correctly and match the preview)

e.g.
OP Post's image from thread 253748455 should have a packed MD5 of ujlTLUO2h564rwtTExF\/VA== obtained from the post entry returned by requesting https://a.4cdn.org/a/thread/253748455.json but instead, when downloading the actual image, the packed MD5 is AmVzMTHfH+fCv3RpwzccSg==.

I tried a few different ways of downloading the files and computing the MD5 because I thought my method of calculating it was the issue but all of them didn't match.

A quick example would be executing curl -v https://i.4cdn.org/a/1686810663343226.jpg | openssl dgst -md5 -binary | base64 and openssl dgst -md5 -binary FILENAME | base64. The two computed hashes match each other but they don't match the one given by the API.

Am I missing something? Is there more information included in the hashed data?

@bakugo
Copy link

bakugo commented Jun 16, 2023

Cloudflare Polish is to blame, it was enabled on 4chan a few weeks ago. You can get the original image by bypassing the cloudflare cache, which can be done by appending a random query string to the url.

@theFra985
Copy link
Author

theFra985 commented Jun 17, 2023

Thank you! After checking that is in fact the cause of the mismatch.

I think it should be documented in the md5 property section to prevent confusion.

@theFra985 theFra985 reopened this Jun 17, 2023
@Tyranical
Copy link

Does not work for b.

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