Click to See Complete Forum and Search --> : Cram-md5


swingall
May 16th, 2002, 07:55 PM
I need some help on the implmentation of CRAM-MD5. I am writing a SMTP client, which needs to handle authentication. I am totally lost. Can anyone help me out? Thanks in advance.

sidy
May 16th, 2002, 08:39 PM
howdy,

I am not sure what CRAM-MD5 is but I have an MD5 class you can use.

Here is the header file, attached is the source code:


/**
*
* MD5 Hashing functions
*
*
* Derived from C source code.
*
* History
* =======
* 11-01-2002 sidy Began re-write
*/
#ifndef _MD5_HASH_HDR_
#define __MD5_HASH_HDR_

class CMD5Hash
{
public:
CMD5Hash();
virtual ~CMD5Hash();
void MD5Init(void);
void MD5Transform(unsigned long *buf, unsigned long *in);
void MD5Final(unsigned char *digest);
void MD5Update(unsigned char *buf, unsigned len);
void byteReverse(unsigned char *buf, unsigned longs);
void getHash(unsigned char *msg, unsigned char *retBuffer); //! msg and return buffer




private:

struct MD5Context
{
unsigned long buf[4];
unsigned long bits[2];
unsigned char in[64];
};


struct MD5Context *ctx;

};



#endif