gpt4 book ai didi

png - PNG文件格式的CRC

转载 作者:行者123 更新时间:2023-12-03 23:32:53 26 4
gpt4 key购买 nike

我需要读取一个 PNG 文件并解释其中存储的所有信息并以人类可读的格式打印它。在处理 PNG 时,我了解到它使用 CRC-32 为每个 block 生成校验和。但我无法理解 PNG 文件规范网站上提到的以下信息:PNG使用的多项式是:x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1

以下是引用链接: http://www.w3.org/TR/PNG/

谁能帮我理解这个?

最佳答案

http://en.wikipedia.org/wiki/Computation_of_CRC ?

根据 wiki 中的 CRC 列表,这个多项式(又名 AUTODIN II 多项式)是最常用的多项式之一。CRC-32-IEEE 802.3 x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1

用于(以太网、V.42、MPEG-2、PNG、POSIX cksum、Arj、Lha32、Rar、Zip 等。)

^标记的力量重写:

 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.

所以你可以阅读 cksum 的来源,例如这里

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.

关于png - PNG文件格式的CRC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2531389/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com