Sync libmd with FreeBSD:
[dragonfly.git] / sys / sys / md5.h
1 /* MD5.H - header file for MD5C.C
2  * $FreeBSD: src/sys/sys/md5.h,v 1.20 2006/03/15 19:47:12 andre Exp $
3  * $DragonFly: src/sys/sys/md5.h,v 1.5 2008/09/11 20:25:34 swildner Exp $
4  */
5
6 /*-
7  Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
8 rights reserved.
9
10 License to copy and use this software is granted provided that it
11 is identified as the "RSA Data Security, Inc. MD5 Message-Digest
12 Algorithm" in all material mentioning or referencing this software
13 or this function.
14
15 License is also granted to make and use derivative works provided
16 that such works are identified as "derived from the RSA Data
17 Security, Inc. MD5 Message-Digest Algorithm" in all material
18 mentioning or referencing the derived work.
19
20 RSA Data Security, Inc. makes no representations concerning either
21 the merchantability of this software or the suitability of this
22 software for any particular purpose. It is provided "as is"
23 without express or implied warranty of any kind.
24
25 These notices must be retained in any copies of any part of this
26 documentation and/or software.
27  */
28
29 #ifndef _SYS_MD5_H_
30 #define _SYS_MD5_H_
31
32 #ifndef _SYS_TYPES_H_
33 #include <sys/types.h>
34 #endif
35
36 #define MD5_BLOCK_LENGTH                64
37 #define MD5_DIGEST_LENGTH               16
38 #define MD5_DIGEST_STRING_LENGTH        (MD5_DIGEST_LENGTH * 2 + 1)
39
40 /* MD5 context. */
41 typedef struct MD5Context {
42   u_int32_t state[4];   /* state (ABCD) */
43   u_int32_t count[2];   /* number of bits, modulo 2^64 (lsb first) */
44   unsigned char buffer[64];     /* input buffer */
45 } MD5_CTX;
46
47 #include <sys/cdefs.h>
48
49 __BEGIN_DECLS
50 void   MD5Init (MD5_CTX *);
51 void   MD5Update (MD5_CTX *, const void *, unsigned int);
52 void   MD5Pad (MD5_CTX *);
53 void   MD5Final (unsigned char [16], MD5_CTX *);
54 char * MD5End(MD5_CTX *, char *);
55 char * MD5File(const char *, char *);
56 char * MD5FileChunk(const char *, char *, off_t, off_t);
57 char * MD5Data(const void *, unsigned int, char *);
58 #ifdef _KERNEL
59 void MD5Transform (u_int32_t [4], const unsigned char [64]);
60 #endif
61 __END_DECLS
62
63 #endif /* _SYS_MD5_H_ */