190d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber/*
2f71323e297a928af368937089d3ed71239786f86Andreas Huber * This is the header file for the MD5 message-digest algorithm.
3f71323e297a928af368937089d3ed71239786f86Andreas Huber * The algorithm is due to Ron Rivest.  This code was
4f71323e297a928af368937089d3ed71239786f86Andreas Huber * written by Colin Plumb in 1993, no copyright is claimed.
5f71323e297a928af368937089d3ed71239786f86Andreas Huber * This code is in the public domain; do with it what you wish.
690d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber *
7f71323e297a928af368937089d3ed71239786f86Andreas Huber * Equivalent code is available from RSA Data Security, Inc.
8f71323e297a928af368937089d3ed71239786f86Andreas Huber * This code has been tested against that, and is equivalent,
9f71323e297a928af368937089d3ed71239786f86Andreas Huber * except that you don't need to include two pages of legalese
10f71323e297a928af368937089d3ed71239786f86Andreas Huber * with every copy.
11f71323e297a928af368937089d3ed71239786f86Andreas Huber *
12f71323e297a928af368937089d3ed71239786f86Andreas Huber * To compute the message digest of a chunk of bytes, declare an
13f71323e297a928af368937089d3ed71239786f86Andreas Huber * MD5Context structure, pass it to MD5Init, call MD5Update as
14f71323e297a928af368937089d3ed71239786f86Andreas Huber * needed on buffers full of bytes, and then call MD5Final, which
15f71323e297a928af368937089d3ed71239786f86Andreas Huber * will fill a supplied 16-byte array with the digest.
16f71323e297a928af368937089d3ed71239786f86Andreas Huber *
17f71323e297a928af368937089d3ed71239786f86Andreas Huber * Changed so as no longer to depend on Colin Plumb's `usual.h'
18f71323e297a928af368937089d3ed71239786f86Andreas Huber * header definitions
19f71323e297a928af368937089d3ed71239786f86Andreas Huber *  - Ian Jackson <ian@chiark.greenend.org.uk>.
20f71323e297a928af368937089d3ed71239786f86Andreas Huber * Still in the public domain.
2190d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber */
2290d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
23b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#ifndef MD5_UTILS_H_
24b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#define MD5_UTILS_H_
25b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian
26b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#ifdef __cplusplus
27b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanianextern "C" {
28b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#endif
2990d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
30f71323e297a928af368937089d3ed71239786f86Andreas Huber#define md5byte unsigned char
31f71323e297a928af368937089d3ed71239786f86Andreas Huber#define UWORD32 unsigned int
3290d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
33f71323e297a928af368937089d3ed71239786f86Andreas Hubertypedef struct MD5Context MD5Context;
34ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuangstruct MD5Context {
35ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang  UWORD32 buf[4];
36ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang  UWORD32 bytes[2];
37ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang  UWORD32 in[16];
38f71323e297a928af368937089d3ed71239786f86Andreas Huber};
39f71323e297a928af368937089d3ed71239786f86Andreas Huber
40f71323e297a928af368937089d3ed71239786f86Andreas Hubervoid MD5Init(struct MD5Context *context);
41f71323e297a928af368937089d3ed71239786f86Andreas Hubervoid MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
42f71323e297a928af368937089d3ed71239786f86Andreas Hubervoid MD5Final(unsigned char digest[16], struct MD5Context *context);
43f71323e297a928af368937089d3ed71239786f86Andreas Hubervoid MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
4490d3ed91ae9228e1c8bab561b6138d4cb8c1e4fdAndreas Huber
45b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#ifdef __cplusplus
46b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian}  // extern "C"
47b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#endif
48b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian
49b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#endif  // MD5_UTILS_H_
50