2 * IRC - Internet Relay Chat, include/ircd_md5.h
4 * This code implements the MD5 message-digest algorithm.
5 * The algorithm is due to Ron Rivest. This code was
6 * written by Colin Plumb in 1993, no copyright is claimed.
7 * This code is in the public domain; do with it what you wish.
9 * Equivalent code is available from RSA Data Security, Inc.
10 * This code has been tested against that, and is equivalent,
11 * except that you don't need to include two pages of legalese
14 * ircuified 2002 by hikari
17 * @brief MD5 implementation for ircu.
23 /** Macro to prepend MD5 variant to a function name. */
24 #define MD5Name(x) Good##x
26 /** Typedef for an unsigned 32-bit integer. */
27 typedef unsigned int uint32;
29 /** MD5 context structure. */
31 uint32 buf[4]; /**< Current digest state/value. */
32 uint32 bits[2]; /**< Number of bits hashed so far. */
33 unsigned char in[64]; /**< Residual input buffer. */
36 void GoodMD5Init(struct MD5Context *);
37 void GoodMD5Update(struct MD5Context *, unsigned const char *, unsigned);
38 void GoodMD5Final(unsigned char digest[16], struct MD5Context *);
39 void GoodMD5Transform(uint32 buf[4], uint32 const in[16]);
40 void BrokenMD5Init(struct MD5Context *);
41 void BrokenMD5Update(struct MD5Context *, unsigned const char *, unsigned);
42 void BrokenMD5Final(unsigned char digest[16], struct MD5Context *);
43 void BrokenMD5Transform(uint32 buf[4], uint32 const in[16]);
45 char *Goodcrypt_md5(const char *pw, const char *salt);
46 char *Brokencrypt_md5(const char *pw, const char *salt);
48 /** Helper typedef for the MD5 context structure. */
49 typedef struct MD5Context MD5_CTX;
51 #endif /* ircd_md5_h */