⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crc.h

📁 各种加密算法的源代码
💻 H
字号:
#ifndef CRC32_H
#define CRC32_H

#include "cryptlib.h"

/* Must use this value instead of ~0 due to 64-bit computers */
const unsigned long CRC32_NEGL = 0xffffffffL;

class CRC32 : public HashModule
{
public:
    CRC32();
    void Update(const byte *input, unsigned int length);
    void Final(byte *hash);
    inline int DigestSize() const {return 4;}

    void Reset() {curr_crc = CRC32_NEGL;}
    void UpdateByte(byte b) {curr_crc = crc_32_tab[byte(curr_crc ^ b)] ^ (curr_crc >> 8);}
    word32 GetCrc() const {return curr_crc ^ CRC32_NEGL;}

private:
    static const unsigned long crc_32_tab[256];
    unsigned long curr_crc;
};

#endif

⌨️ 快捷键说明

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