00001 #ifndef MD5_H
00002 #define MD5_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #define HASHLEN 16
00027 typedef char HASH[HASHLEN];
00028 #define HASHHEXLEN 32
00029 typedef char HASHHEX[HASHHEXLEN + 1];
00030 #ifdef WIN32
00031 #undef IN
00032 #endif
00033 #define IN const
00034 #define OUT
00035
00036
00037
00038 extern void
00039 DigestCalcHA1(
00040 IN char * pszAlg,
00041 IN char * pszUserName,
00042 IN char * pszRealm,
00043 IN char * pszPassword,
00044 IN char * pszNonce,
00045 IN char * pszCNonce,
00046 OUT HASHHEX SessionKey
00047 );
00048
00049
00050 extern void
00051 DigestCalcResponse(
00052 IN HASHHEX HA1,
00053 IN char * pszNonce,
00054 IN char * pszNonceCount,
00055 IN char * pszCNonce,
00056 IN char * pszQop,
00057 IN char * pszMethod,
00058 IN char * pszDigestUri,
00059 IN HASHHEX HEntity,
00060 OUT HASHHEX HA2Hex,
00061 OUT HASHHEX Response
00062 );
00063
00064
00065
00066 extern void
00067 CvtHex(
00068 IN HASH Bin,
00069 OUT HASHHEX Hex
00070 );
00071
00072
00073 #ifdef __cplusplus
00074 extern "C"
00075 {
00076 #endif
00077
00078 #define md5byte unsigned char
00079
00080 struct MD5Context
00081 {
00082 unsigned int buf[4];
00083 unsigned int bytes[2];
00084 unsigned int in[16];
00085 };
00086
00087 void MD5Init(struct MD5Context *context);
00088 void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
00089 void MD5Final(unsigned char digest[16], struct MD5Context *context);
00090 void MD5Transform(unsigned int buf[4], unsigned int const in[16]);
00091
00092 #ifdef __cplusplus
00093 }
00094 #endif
00095
00096
00097 #endif