xref: /freebsd/sys/sys/md5.h (revision 2ff63af9)
1 /* MD5.H - header file for MD5C.C
2  */
3 
4 /*-
5  SPDX-License-Identifier: RSA-MD
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 #define MD5_BLOCK_LENGTH		64
33 #define MD5_DIGEST_LENGTH		16
34 #define MD5_DIGEST_STRING_LENGTH	(MD5_DIGEST_LENGTH * 2 + 1)
35 
36 /* MD5 context. */
37 typedef struct MD5Context {
38   u_int32_t state[4];	/* state (ABCD) */
39   u_int32_t count[2];	/* number of bits, modulo 2^64 (lsb first) */
40   unsigned char buffer[64];	/* input buffer */
41 } MD5_CTX;
42 
43 #include <sys/cdefs.h>
44 
45 __BEGIN_DECLS
46 void   MD5Init (MD5_CTX *);
47 void   MD5Update (MD5_CTX *, const void *, unsigned int);
48 void   MD5Final (unsigned char[__min_size(MD5_DIGEST_LENGTH)], MD5_CTX *);
49 #ifndef _KERNEL
50 char * MD5End(MD5_CTX *, char *);
51 char * MD5Fd(int, char *);
52 char * MD5FdChunk(int, char *, off_t, off_t);
53 char * MD5File(const char *, char *);
54 char * MD5FileChunk(const char *, char *, off_t, off_t);
55 char * MD5Data(const void *, unsigned int, char *);
56 #endif
57 __END_DECLS
58 #endif /* _SYS_MD5_H_ */
59