1 /* 2 * This code implements the MD5 message-digest algorithm. 3 * The algorithm is due to Ron Rivest. This code was 4 * written by Colin Plumb in 1993, no copyright is claimed. 5 * This code is in the public domain; do with it what you wish. 6 * 7 * Equivalent code is available from RSA Data Security, Inc. 8 * This code has been tested against that, and is equivalent, 9 * except that you don't need to include two pages of legalese 10 * with every copy. 11 * 12 * To compute the message digest of a chunk of bytes, declare an 13 * MD5Context structure, pass it to MD5Init, call MD5Update as 14 * needed on buffers full of bytes, and then call MD5Final, which 15 * will fill a supplied 16-byte array with the digest. 16 */ 17 18 /* Brutally hacked by John Walker back from ANSI C to K&R (no 19 prototypes) to maintain the tradition that Netfone will compile 20 with Sun's original "cc". */ 21 22 #ifndef MD5_H 23 #define MD5_H 24 25 #include "platform.h" 26 #ifdef WORDS_BIGENDIAN 27 #define HIGHFIRST 28 #endif 29 30 #define MD5_DIGEST_SIZE 16 31 32 struct MD5Context 33 { 34 uint32_t buf[4]; 35 uint32_t bits[2]; 36 unsigned char in[64]; 37 }; 38 39 40 void 41 MD5Init(struct MD5Context *ctx); 42 43 void 44 MD5Update(struct MD5Context *ctx, 45 const void *buf, 46 unsigned len); 47 48 void 49 MD5Final(unsigned char digest[MD5_DIGEST_SIZE], 50 struct MD5Context *ctx); 51 52 #endif /* !MD5_H */ 53