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 #ifndef MD5_H
19 #define MD5_H
20 
21 /* Minor tweaks for use from Omega:
22  *
23  * + Include netinet/in.h and/or arpa/inet.h to get uint32_t.
24  * + uint32 -> uint32_t.
25  * + MD5Transform is an internal helper so prototype moved to md5.cc.
26  * + Removed MD5_CTX.
27  * + Changed MD5Context.in to uint32_t instead of unsigned char.
28  */
29 
30 // To get uint32_t:
31 #ifdef HAVE_WORKING_STDINT_H
32 # include <stdint.h>
33 #else
34 # ifdef HAVE_ARPA_INET_H
35 #  include <arpa/inet.h>
36 # endif
37 # ifdef HAVE_NETINET_IN_H
38 #  include <netinet/in.h>
39 # endif
40 # ifdef __WIN32__
41 typedef unsigned int uint32_t;
42 # endif
43 #endif
44 
45 struct MD5Context {
46     uint32_t buf[4];
47     uint32_t bits[2];
48     uint32_t in[16];
49 };
50 
51 void MD5Init(struct MD5Context *context);
52 void MD5Update(struct MD5Context *context, unsigned char const *buf,
53 	       unsigned len);
54 void MD5Final(unsigned char digest[16], struct MD5Context *context);
55 
56 #endif /* !MD5_H */
57