// WMMD5.h: interface for the WMMD5 class.
//
//////////////////////////////////////////////////////////////////////
//
// NO WARRANTY: This software is provided AS IS, without warranty of any kind.
//
//////////////////////////////////////////////////////////////////////
//
// Class used to implement MD5 digest algorithm (RFC 1321).
// Author: Robert Cunnings
// Incorporates code written by Eric Young and modified by Wei Dai and
// published as 'md5.cpp' - Copyright 1995 Eric Young.
// 
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_WMMD5_H__1E1604F4_1D6C_4E41_A46D_F609BA0BBBA0__INCLUDED_)
#define AFX_WMMD5_H__1E1604F4_1D6C_4E41_A46D_F609BA0BBBA0__INCLUDED_

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

#include <string>
using namespace std;

#define DIGEST_SIZE 16
#define DATA_BLOCKSIZE 64
#define LAST_DATA_BLOCKSIZE 56
#define LEN_LOWORD_OFFSET 14
#define LEN_HIWORD_OFFSET 15

class WMMD5  
{
public:
	WMMD5();
	virtual ~WMMD5();
	void Update(const unsigned char *pInput, unsigned long ulLength);
	void Finalize(unsigned long *pDigest);
	void FinalizeHexEncoded(string& strDigest);

protected:
	void Initialize();
	void ProcessBlock();

	unsigned long m_ulDigest[4];
	unsigned long m_ulBuffer[DATA_BLOCKSIZE / sizeof(unsigned long)];
	unsigned long m_ulCountLoWord;
	unsigned long m_ulCountHiWord;
};

#endif // !defined(AFX_WMMD5_H__1E1604F4_1D6C_4E41_A46D_F609BA0BBBA0__INCLUDED_)
