CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Cram-md5

  1. #1
    Join Date
    May 2002
    Location
    FL
    Posts
    6

    Cram-md5

    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.

  2. #2
    Join Date
    Apr 2001
    Location
    Brisbane, Australia
    Posts
    17
    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:

    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
    ==========================
    Sid Young
    Sunny Queensland
    Australia (Oz)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured