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

📄 checksum.h

📁 《Visual C++视频技术方案宝典》配套光盘
💻 H
字号:
// Checksum.h: interface for the CChecksum class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CHECKSUM_H__38B29966_E9C1_4C23_A645_A918ECD481E3__INCLUDED_)
#define AFX_CHECKSUM_H__38B29966_E9C1_4C23_A645_A918ECD481E3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

//Magic initialization constants
#define MD5_INIT_STATE_0 0x67452301
#define MD5_INIT_STATE_1 0xefcdab89
#define MD5_INIT_STATE_2 0x98badcfe
#define MD5_INIT_STATE_3 0x10325476

//Constants for Transform routine.
#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

static unsigned char PADDING[64] = {
	0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

class CChecksum  
{
public:
	CString Final();
	void DWordToByte(BYTE* Output, DWORD* Input, UINT nLength);
	void Transform(BYTE Block[64]);
	void ByteToDWord(DWORD* Output, BYTE* Input, UINT nLength);
	void II( DWORD& A, DWORD B, DWORD C, DWORD D, DWORD X, DWORD S, DWORD T);
	void HH( DWORD& A, DWORD B, DWORD C, DWORD D, DWORD X, DWORD S, DWORD T);
	void GG( DWORD& A, DWORD B, DWORD C, DWORD D, DWORD X, DWORD S, DWORD T);
	void FF( DWORD& A, DWORD B, DWORD C, DWORD D, DWORD X, DWORD S, DWORD T);
	DWORD RotateLeft(DWORD x, int n);
	void Update( BYTE* Input,ULONG nInputLen );
	static CString GetMD5(CFile& File);
	static CString GetMD5(const CString& strFilePath);
	CChecksum();
	virtual ~CChecksum();
	BYTE  m_Buffer[64];	//input buffer
	ULONG m_Count[2];	//number of bits, modulo 2^64 (lsb first)
	ULONG m_MD5[4];		//MD5 checksum
};

#endif // !defined(AFX_CHECKSUM_H__38B29966_E9C1_4C23_A645_A918ECD481E3__INCLUDED_)

⌨️ 快捷键说明

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