00001 /* 00002 * This code implements 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 00018 /* Brutally hacked by John Walker back from ANSI C to K&R (no 00019 prototypes) to maintain the tradition that Netfone will compile 00020 with Sun's original "cc". */ 00021 00022 #ifndef MD5_H 00023 #define MD5_H 00024 00025 #include "platform.h" 00026 #ifdef WORDS_BIGENDIAN 00027 #define HIGHFIRST 00028 #endif 00029 00030 #define MD5_DIGEST_SIZE 16 00031 00032 struct MD5Context 00033 { 00034 uint32_t buf[4]; 00035 uint32_t bits[2]; 00036 unsigned char in[64]; 00037 }; 00038 00039 00040 void 00041 MD5Init(struct MD5Context *ctx); 00042 00043 void 00044 MD5Update(struct MD5Context *ctx, 00045 const void *buf, 00046 unsigned len); 00047 00048 void MD5Final(unsigned char digest[MD5_DIGEST_SIZE], 00049 struct MD5Context *ctx); 00050 00051 #endif /* !MD5_H */