md5.h
Go to the documentation of this file.
00001 /*
00002  *      This is the C++ implementation of the MD5 Message-Digest
00003  *      Algorithm desrcipted in RFC 1321.
00004  *      I translated the C code from this RFC to C++.
00005  *      There is now warranty.
00006  *
00007  *      Feb. 12. 2005
00008  *      Benjamin Gr¨ądelbach
00009  */
00010 
00011 /*
00012  * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
00013  * rights reserved.
00014  * 
00015  * License to copy and use this software is granted provided that it
00016  * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
00017  * Algorithm" in all material mentioning or referencing this software
00018  * or this function.
00019  * 
00020  * License is also granted to make and use derivative works provided
00021  * that such works are identified as "derived from the RSA Data
00022  * Security, Inc. MD5 Message-Digest Algorithm" in all material
00023  * mentioning or referencing the derived work.
00024  * 
00025  * RSA Data Security, Inc. makes no representations concerning either
00026  * the merchantability of this software or the suitability of this
00027  * software for any particular purpose. It is provided "as is"
00028  * without express or implied warranty of any kind.
00029  * 
00030  * These notices must be retained in any copies of any part of this
00031  * documentation and/or software.
00032  */
00033 
00034 //---------------------------------------------------------------------- 
00035 //include protection
00036 #ifndef MD5_H
00037 #define MD5_H
00038 
00039 //---------------------------------------------------------------------- 
00040 //STL includes
00041 #include <string>
00042 
00043 //---------------------------------------------------------------------- 
00044 //typedefs
00045 typedef unsigned char *POINTER;
00046 
00047 /*
00048  * MD5 context.
00049  */
00050 typedef struct 
00051 {
00052         unsigned long int state[4];           /* state (ABCD) */
00053         unsigned long int count[2];           /* number of bits, modulo 2^64 (lsb first) */
00054         unsigned char buffer[64];             /* input buffer */
00055 } MD5_CTX;
00056 
00057 /*
00058  * MD5 class
00059  */
00060 class MD5
00061 {
00062 
00063         private:
00064 
00065                 void MD5Transform (unsigned long int state[4], unsigned char block[64]);
00066                 void Encode (unsigned char*, unsigned long int*, unsigned int);
00067                 void Decode (unsigned long int*, unsigned char*, unsigned int);
00068                 void MD5_memcpy (POINTER, POINTER, unsigned int);
00069                 void MD5_memset (POINTER, int, unsigned int);
00070 
00071         public:
00072         
00073                 void MD5Init (MD5_CTX*);
00074                 void MD5Update (MD5_CTX*, unsigned char*, unsigned int);
00075                 void MD5Final (unsigned char [16], MD5_CTX*);
00076 
00077         MD5(){};
00078 };
00079 
00080 //---------------------------------------------------------------------- 
00081 //End of include protection
00082 #endif
00083 
00084 /*
00085  * EOF
00086  */


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29