Sync libmd with FreeBSD:
[dragonfly.git] / sys / sys / md5.h
CommitLineData
984263bc 1/* MD5.H - header file for MD5C.C
3cd01911
SW
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 $
984263bc
MD
4 */
5
3cd01911
SW
6/*-
7 Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
984263bc
MD
8rights reserved.
9
10License to copy and use this software is granted provided that it
11is identified as the "RSA Data Security, Inc. MD5 Message-Digest
12Algorithm" in all material mentioning or referencing this software
13or this function.
14
15License is also granted to make and use derivative works provided
16that such works are identified as "derived from the RSA Data
17Security, Inc. MD5 Message-Digest Algorithm" in all material
18mentioning or referencing the derived work.
19
20RSA Data Security, Inc. makes no representations concerning either
21the merchantability of this software or the suitability of this
22software for any particular purpose. It is provided "as is"
23without express or implied warranty of any kind.
24
25These notices must be retained in any copies of any part of this
26documentation and/or software.
27 */
28
29#ifndef _SYS_MD5_H_
30#define _SYS_MD5_H_
1bd40720
MD
31
32#ifndef _SYS_TYPES_H_
33#include <sys/types.h>
34#endif
35
3cd01911
SW
36#define MD5_BLOCK_LENGTH 64
37#define MD5_DIGEST_LENGTH 16
38#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)
39
984263bc
MD
40/* MD5 context. */
41typedef 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
50void MD5Init (MD5_CTX *);
3cd01911 51void MD5Update (MD5_CTX *, const void *, unsigned int);
984263bc
MD
52void MD5Pad (MD5_CTX *);
53void MD5Final (unsigned char [16], MD5_CTX *);
54char * MD5End(MD5_CTX *, char *);
55char * MD5File(const char *, char *);
3cd01911
SW
56char * MD5FileChunk(const char *, char *, off_t, off_t);
57char * MD5Data(const void *, unsigned int, char *);
984263bc 58#ifdef _KERNEL
b153f746 59void MD5Transform (u_int32_t [4], const unsigned char [64]);
984263bc
MD
60#endif
61__END_DECLS
1bd40720 62
984263bc 63#endif /* _SYS_MD5_H_ */