#ifndef	__MY_CHASHMD5_H__
#define	__MY_CHASHMD5_H__

/*
 *
 * RCF 1321 - MD5 hash function implementation
 *
 */


/*
 * used types definition
 */

#ifndef	uint8
#define	uint8	unsigned char
#endif	// uint8

#ifndef	uint32
#define	uint32	unsigned long int
#endif	//uint32



/*
 * class declaration
 */

class	CHashMD5
{
public:

	CHashMD5();
	~CHashMD5();

	struct	SMD5Context
	{
		uint32	p_ui32_Total[ 2];
		uint32	p_ui32_State[ 4];
		uint8	p_ui8_Buffer[64];
	};

	void	m_start( SMD5Context *ctx);
	void	m_update( SMD5Context *ctx, uint8 *input, uint32 length);
	void	m_finish( SMD5Context *ctx, uint8 digest[16]);

	void	m_hash( char md5hash[32+1], const char *buffer, const uint32 length);

private:

	void	m_process( SMD5Context *ctx, uint8 data[64]);

	SMD5Context	m_tCtx;
};

#endif	// __MY_CHASHMD5_H__

