]> git.sur5r.net Git - openldap/blob - include/lutil_sha1.h
eaac88289d37e7ecf6c8f629bcf7e7c86dd822cb
[openldap] / include / lutil_sha1.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms are permitted only
7  * as authorized by the OpenLDAP Public License.  A copy of this
8  * license is available at http://www.OpenLDAP.org/license.html or
9  * in file LICENSE in the top-level directory of the distribution.
10  */
11
12 /* This version is based on:
13  *      $OpenBSD: sha1.h,v 1.8 1997/07/15 01:54:23 millert Exp $        */
14
15 #ifndef _LUTIL_SHA1_H_
16 #define _LUTIL_SHA1_H_
17
18 #include <ldap_cdefs.h>
19 #include <ac/bytes.h>
20
21 LDAP_BEGIN_DECL
22
23 /*
24  * SHA-1 in C
25  * By Steve Reid <steve@edmweb.com>
26  */
27
28 /* This code assumes char are 8-bits and uint32 are 32-bits */
29 typedef ac_uint4 uint32;
30
31 typedef struct {
32     uint32 state[5];
33     uint32 count[2];  
34     unsigned char buffer[64];
35 } lutil_SHA1_CTX;
36   
37 LIBLUTIL_F( void )
38 lutil_SHA1Transform
39         LDAP_P((uint32 state[5], const unsigned char buffer[64]));
40
41 LIBLUTIL_F( void  )
42 lutil_SHA1Init
43         LDAP_P((lutil_SHA1_CTX *context));
44
45 LIBLUTIL_F( void  )
46 lutil_SHA1Update
47         LDAP_P((lutil_SHA1_CTX *context, const unsigned char *data, uint32 len));
48
49 LIBLUTIL_F( void  )
50 lutil_SHA1Final
51         LDAP_P((unsigned char digest[20], lutil_SHA1_CTX *context));
52
53 LIBLUTIL_F( char * )
54 lutil_SHA1End
55         LDAP_P((lutil_SHA1_CTX *, char *));
56
57 LIBLUTIL_F( char * )
58 lutil_SHA1File
59         LDAP_P((char *, char *));
60
61 LIBLUTIL_F( char * )
62 lutil_SHA1Data
63         LDAP_P((const unsigned char *, size_t, char *));
64
65 LDAP_END_DECL
66
67 #endif /* _LUTIL_SHA1_H_ */