I need to read a PNG file and interpret all the information stored in it and print it in human readable format. While working on PNG, I understood that it uses CRC-32 for generating checksum for each chunk. But I could not understand the following information mentioned on the PNG file specification site: The polynomial used by PNG is: x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1
Here is the link for reference: http://www.w3.org/TR/PNG/
Can anyone please help me in understanding this?
http://en.wikipedia.org/wiki/Computation_of_CRC ?
According to list of CRCs in wiki, this polynomial (aka AUTODIN II polynomial ) is one of the most used. CRC-32-IEEE 802.3 x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1
Used in (Ethernet, V.42, MPEG-2, PNG, POSIX cksum, Arj, Lha32, Rar, Zip, and more..)
Rewritted with power marked by ^
:
x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1.
So you can read source of cksum, e.g. here
http://www.opensource.apple.com/source/file_cmds/file_cmds-188/cksum/crc32.c
The 32-bit AutoDIN-II CRC is built upon the following shift-register reference model.
Polynomial: g(x) = 1 + x + x^4 + x^5 + x^7 + x^8 + x^10 + x^11 + x^12 + x^1 + x^22 + x^23 + x^26 + x^32
Input data bit 0 first
Leading-zero checking is performed by the following procedure: 1. The crc register is initialized to 0xffffffff, not zero. 2. When a crc is appended, the 32 bits of the crc are inverted. 3. When checking a good message with an appended crc, the register will return to the fixed value of 0xdebb20e3, rather than zero.