crc32.h

来自「CRC校验采用多项式编码方法。多项式乘除法运算过程与普通代数多项式的乘除法相同。」· C头文件 代码 · 共 38 行

H
38
字号
#ifndef CRC32_INCLUDED#  define CRC32_INCLUDED#include "defs.h"/* * This code has some adaptations for the Ghostscript environment, but it * will compile and run correctly in any environment with 8-bit chars and * 32-bit ints.  Specifically, it assumes that if the following are * defined, they have the same meaning as in Ghostscript: P1, P2, P3. *//* Define the state of the CRC32 Algorithm. */typedef struct crc32_state_s {    uint32_t count[2];	/* message length in bits, lsw first */    uint32_t state[1];	/* digest buffer */} CRC32_CTX;#ifdef RUBY#define CRC32_Init	rb_Digest_CRC32_Init#define CRC32_Update	rb_Digest_CRC32_Update#define CRC32_Final	rb_Digest_CRC32_Final#define CRC32_End		rb_Digest_CRC32_End#define CRC32_Equal	rb_Digest_CRC32_Equal#endifvoid	CRC32_Init _((CRC32_CTX *pms));void	CRC32_Update _((CRC32_CTX *pms, const uint8_t *data, size_t nbytes));void	CRC32_Final _((uint8_t *digest, CRC32_CTX *pms));void	CRC32_End _((CRC32_CTX *pctx, uint8_t *hexdigest));int	CRC32_Equal _((CRC32_CTX *pctx1, CRC32_CTX *pctx2));#define CRC32_BLOCK_LENGTH		1#define CRC32_DIGEST_LENGTH		4#define CRC32_DIGEST_STRING_LENGTH	(CRC32_DIGEST_LENGTH * 2 + 1)#endif /* CRC32_INCLUDED */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?