libnative-utilities/include/utils/CRC.hpp

31 lines
601 B
C++
Raw Permalink Normal View History

2024-08-15 18:40:30 +08:00
#ifndef CRC_HPP
#define CRC_HPP
class CRC{
private:
static const unsigned int CRC32_POLYNOMIAL;
static const unsigned int CRC32_POLYNOMIAL_DRF;
unsigned int* crc32_table=0;
public:
static const unsigned int CRC_MODE_DEFAULT;
static const unsigned int CRC_MODE_DRF;
unsigned int update_crc32(const unsigned char* data, unsigned int dataLength, unsigned int old_crc32);
unsigned int getCRC32(const unsigned char* data, unsigned int dataLength);
CRC(unsigned int mode=CRC::CRC_MODE_DEFAULT);
~CRC();
};
#endif