#pragma once #include // 添加标准整数类型支持 #include // 添加 size_t 支持 #ifdef CRC64_EXPORTS #define CRC64_API #define CRC64_C_API extern "C" #else #define CRC64_API #define CRC64_C_API extern "C" #endif // 定义跨平台类型别名 using DWORD = unsigned long; // Linux 兼容的 DWORD 类型 using UINT64 = uint64_t; // 标准 64 位无符号整数 using UINT4 = uint32_t; // 标准 32 位无符号整数 using UINT2 = uint16_t; // 标准 16 位无符号整数 using POINTER = unsigned char*; // 此类是从 Crc64.dll 导出的 class CCrc64 { public: CCrc64(void); // TODO: 在此添加您的方法。 }; class CCrc32 { public: CCrc32(void); // TODO: 在此添加您的方法。 }; CRC64_C_API UINT64 GetCrc64(const char *pSrc, DWORD size); CRC64_API int GetCrc32(const char *pSrc, size_t size); CRC64_API unsigned short CRC16(const unsigned char* pDataIn, size_t iLenIn); /* PROTOTYPES should be set to one if and only if the compiler supports function argument prototyping. The following makes PROTOTYPES default to 0 if it has not already been defined with C compiler flags. */ #ifndef PROTOTYPES #define PROTOTYPES 0 #endif /* POINTER defines a generic pointer type */ //typedef unsigned char *POINTER; // ///* UINT2 defines a two byte word */ //typedef unsigned short int UINT2; // ///* UINT4 defines a four byte word */ //typedef unsigned long int UINT4; /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it returns an empty list. */ #if PROTOTYPES #define PROTO_LIST(list) list #else #define PROTO_LIST(list) () #endif /* MD5 context. */ typedef struct _MD5_CTX{ UINT4 state[4]; /* state (ABCD) */ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64];/* input buffer */ } MD5_CTX; CRC64_C_API void MD5Init(MD5_CTX *); CRC64_C_API void MD5Update(MD5_CTX *, unsigned char *, unsigned int); CRC64_C_API void MD5Final(unsigned char[16], MD5_CTX *); /* extended function */ CRC64_C_API int MDFile(char *filename, char *digest); CRC64_C_API void MDPrint(unsigned char digest[16]); CRC64_C_API void MDString(const char *str, unsigned char *digest); CRC64_C_API void MDData(char *data, int len, unsigned char *digest);