#pragma once // 下列 ifdef 块是创建使从 DLL 导出更简单的 // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 CRC64_EXPORTS // 符号编译的。在使用此 DLL 的 // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将 // CRC64_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的 // 符号视为是被导出的。 #ifndef CRC64_EXPORTS #ifdef _WIN64 #ifdef _DEBUG #pragma comment(lib, "Crc64X64D.lib") #else #pragma comment(lib, "Crc64X64.lib") #endif #else #ifdef _DEBUG #pragma comment(lib, "Crc64D.lib") #else #pragma comment(lib, "Crc64.lib") #endif #endif #endif #ifdef CRC64_EXPORTS #define CRC64_API __declspec(dllexport) #define CRC64_C_API extern "C" __declspec(dllexport) #else #define CRC64_API __declspec(dllimport) #define CRC64_C_API extern "C" __declspec(dllimport) #endif // 此类是从 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);