libUPnP
1.6.17
|
00001 /* 00002 * This is the header file for the MD5 message-digest algorithm. 00003 * The algorithm is due to Ron Rivest. This code was 00004 * written by Colin Plumb in 1993, no copyright is claimed. 00005 * This code is in the public domain; do with it what you wish. 00006 * 00007 * Equivalent code is available from RSA Data Security, Inc. 00008 * This code has been tested against that, and is equivalent, 00009 * except that you don't need to include two pages of legalese 00010 * with every copy. 00011 * 00012 * To compute the message digest of a chunk of bytes, declare an 00013 * MD5Context structure, pass it to MD5Init, call MD5Update as 00014 * needed on buffers full of bytes, and then call MD5Final, which 00015 * will fill a supplied 16-byte array with the digest. 00016 * 00017 * Changed so as no longer to depend on Colin Plumb's `usual.h' 00018 * header definitions; now uses stuff from dpkg's config.h 00019 * - Ian Jackson <ian@chiark.greenend.org.uk>. 00020 * Still in the public domain. 00021 */ 00022 00023 #ifndef MD5_H 00024 #define MD5_H 00025 00026 #define md5byte unsigned char 00027 00028 #if SIZEOF_UNSIGNED_LONG==4 00029 # define UWORD32 unsigned long 00030 #elif SIZEOF_UNSIGNED_INT==4 00031 # define UWORD32 unsigned int 00032 #else 00033 # error I do not know what to use for a UWORD32. 00034 #endif 00035 00036 struct MD5Context { 00037 UWORD32 buf[4]; 00038 UWORD32 bytes[2]; 00039 UWORD32 in[16]; 00040 }; 00041 00042 void MD5Init(struct MD5Context *context); 00043 void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len); 00044 void MD5Final(unsigned char digest[16], struct MD5Context *context); 00045 void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]); 00046 00047 #endif /* !MD5_H */