h2non / filetype.py

Small, dependency-free, fast Python package to infer binary file types checking the magic numbers signature
https://h2non.github.io/filetype.py
MIT License
650 stars 111 forks source link

Match against all 8 PNG file signature bytes #190

Open sudhir-b opened 1 week ago

sudhir-b commented 1 week ago

Update the PNG matcher to match all 8 bytes of the PNG signature as in: https://www.w3.org/TR/png/#5PNG-file-signature

I'm not sure that this makes any functional difference but spotted a discrepancy and thought I'd open this PR for completeness.

As an aside, it looks like the APNG matcher matches against an identical bytearray to begin with - is there a reason for this difference in the two matchers?

CatKasha commented 1 hour ago

APNG matcher was made by me and i forgot(?) to edit PNG matcher Feel free to edit APNG matcher to use if instead of bytearray