md5_check.h

来自「跨操作系统的微型中间件」· C头文件 代码 · 共 81 行

H
81
字号
#ifdef WIN32#ifndef MD5_H#define MD5_H#ifdef __alphatypedef unsigned int uint32;#elsetypedef unsigned long uint32;#endif#define MD5_CHECK_SUCCESS	0#define MD5_CHECK_FAILED	1#define MD5_CHECK_KEY_MAX_LEN	20#ifndef ASM_MD5/* The four core functions - F1 is optimized somewhat *//* #define F1(x, y, z) (x & y | ~x & z) */#define F1(x, y, z) (z ^ (x & (y ^ z)))#define F2(x, y, z) F1(z, x, y)#define F3(x, y, z) (x ^ y ^ z)#define F4(x, y, z) (y ^ (x | ~z))/* This is the central step in the MD5 algorithm. */#define MD5STEP(f, w, x, y, z, data, s) \	( w +=  f(x, y, z) + data,  w = w<<s | w>>(32-s),  w +=  x )#endifstruct MD5Context {	uint32 buf[4];	uint32 bits[2];	unsigned char in[64];};/* * This is needed to make RSAREF happy on some MS-DOS compilers. */typedef struct MD5Context MD5_CTX;class MD5_Check{public:	ULONG GetMD5Result(BYTE *pcBuf, int pcLen, BYTE* MD5Result);	~MD5_Check();	MD5_Check();		#ifndef ASM_MD5	void MD5Final(unsigned char digest[16], struct MD5Context *context);#endifprivate:	ULONG SetMD5Key(char *pKey, ULONG iLen);		ULONG MD5MessageEncode(BYTE *pcBuf, int pcLen);	ULONG MD5MessageDecode(BYTE *pcBuf, int pcLen);	void MD5Init(struct MD5Context *context);	void MD5Update(struct MD5Context *context, unsigned char const *buf,	       unsigned len);		void MD5Transform(uint32 buf[4], uint32 const in[16]);		/*	* Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious	* initialization constants.	*/	char   szSharedKey[MD5_CHECK_KEY_MAX_LEN];	ULONG  iKeyLen;};#endif /* !MD5_H */#endif

⌨️ 快捷键说明

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