1 #ifndef __WZD_MD5_H__
2 #define __WZD_MD5_H__
3 
4 /*! \addtogroup libwzd_auth
5  *  @{
6  */
7 
8 typedef unsigned int uint32;
9 
10 #define MD5_DIGEST_SIZE 16
11 typedef unsigned char MD5_DIGEST[MD5_DIGEST_SIZE];
12 
13 struct MD5Context {
14     uint32 buf[4];
15     uint32 bits[2];
16     unsigned char in[64];
17 };
18 
19 void GoodMD5Init(struct MD5Context *);
20 void GoodMD5Update(struct MD5Context *, unsigned const char *, unsigned);
21 void GoodMD5Final(unsigned char digest[16], struct MD5Context *);
22 void GoodMD5Transform(uint32 buf[4], uint32 const in[16]);
23 void BrokenMD5Init(struct MD5Context *);
24 void BrokenMD5Update(struct MD5Context *, unsigned const char *, unsigned);
25 void BrokenMD5Final(unsigned char digest[16], struct MD5Context *);
26 void BrokenMD5Transform(uint32 buf[4], uint32 const in[16]);
27 
28 char *Goodcrypt_md5(const char *pw, const char *salt);
29 char *Brokencrypt_md5(const char *pw, const char *salt);
30 
31 
32 /* FIXME VISUAL */
33 #define MD5Name(x) (Good ## x)
34 
35 /* Read string and fills tab crc[16] */
36 void strtomd5(char *ptr,char **ptest, unsigned char *crc);
37 
38 /* Calculates the md5 checksum of fname, and stores the result
39  * in crc. Returns 0 on success, nonzero on error.
40  */
41 int calc_md5( const char *fname, unsigned char md5_crc[16], unsigned long startpos, unsigned long length );
42 
43 void md5_digest(const void *msg, unsigned int len, MD5_DIGEST);
44 
45 /*! @} */
46 
47 #endif /* __WZD_MD5_H__ */
48 
49