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

📄 md5.h

📁 这是一个在vc环境下编译通过的MD5算法。包含算法源代码和测试主程序。
💻 H
字号:
///////////////////////////////////////////////////////
//                           MD5算法实现头文件
//
typedef unsigned char *POINTER;
typedef unsigned int UINT2;
typedef unsigned long  ULONG;
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
// MD5 context. 
typedef struct
{
	ULONG state[4];           // (ABCD) 
	ULONG count[2];           //信息字节数
	unsigned char buffer[64]; //待处理数据
} MD5_CTX;

class CMD5
{
   private:
	inline ULONG LRotate(ULONG Sdata,int nBit);
	inline ULONG F(ULONG x,ULONG y,ULONG z);
	inline ULONG G(ULONG x,ULONG y,ULONG z);
	inline ULONG H(ULONG x,ULONG y,ULONG z);
	inline ULONG I(ULONG x,ULONG y,ULONG z);
	inline void FF(ULONG &a,ULONG b,ULONG c,ULONG d,ULONG Msg,int nBit,ULONG Cnt);
    inline void GG(ULONG &a,ULONG b,ULONG c,ULONG d,ULONG Msg,int nBit,ULONG Cnt);
    inline void HH(ULONG &a,ULONG b,ULONG c,ULONG d,ULONG Msg,int nBit,ULONG Cnt);
    inline void II(ULONG &a,ULONG b,ULONG c,ULONG d,ULONG Msg,int nBit,ULONG Cnt);
   public :
	MD5_CTX context;
	void Init(MD5_CTX *context);
	void Md5(MD5_CTX *context, const unsigned char *input, unsigned int inputLen);
	void Final(unsigned char digest[16], MD5_CTX *context);
	void Transform(ULONG state[4], const unsigned char block[64]);
};

⌨️ 快捷键说明

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