]> git.sur5r.net Git - openldap/blob - include/lutil_md5.h
Add OpenLDAP Copyright to headers
[openldap] / include / lutil_md5.h
1 /*
2  * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted only
6  * as authorized by the OpenLDAP Public License.  A copy of this
7  * license is available at http://www.OpenLDAP.org/license.html or
8  * in file LICENSE in the top-level directory of the distribution.
9  */
10
11 /* See md5.c for explanation and copyright information.  */
12
13 #ifndef _LUTIL_MD5_H_
14 #define _LUTIL_MD5_H_
15
16 #include <ldap_cdefs.h>
17 #include <ac/bytes.h>
18
19 LDAP_BEGIN_DECL
20
21 /* Unlike previous versions of this code, uint32 need not be exactly
22    32 bits, merely 32 bits or more.  Choosing a data type which is 32
23    bits instead of 64 is not important; speed is considerably more
24    important.  ANSI guarantees that "unsigned long" will be big enough,
25    and always using it seems to have few disadvantages.  */
26
27 #ifndef LDAP_UINT32
28 #define LDAP_UINT32 1
29 typedef LDAP_UINT4 uint32;
30 #endif
31
32 struct lutil_MD5Context {
33         uint32 buf[4];
34         uint32 bits[2];
35         unsigned char in[64];
36 };
37
38 LDAP_F void lutil_MD5Init LDAP_P((
39         struct lutil_MD5Context *context));
40
41 LDAP_F void lutil_MD5Update LDAP_P((
42         struct lutil_MD5Context *context,
43         unsigned char const *buf,
44         unsigned len));
45
46 LDAP_F void lutil_MD5Final LDAP_P((
47         unsigned char digest[16],
48         struct lutil_MD5Context *context));
49
50 LDAP_F void lutil_MD5Transform LDAP_P((
51         uint32 buf[4],
52         const unsigned char in[64]));
53
54 /*
55  * This is needed to make RSAREF happy on some MS-DOS compilers.
56  */
57 typedef struct lutil_MD5Context lutil_MD5_CTX;
58
59 LDAP_END_DECL
60
61 #endif /* _LUTIL_MD5_H_ */