]> git.sur5r.net Git - openldap/blob - include/lutil_sha1.h
VC++ Port: round 1
[openldap] / include / lutil_sha1.h
1 /* This version is based on:
2  *      $OpenBSD: sha1.h,v 1.8 1997/07/15 01:54:23 millert Exp $        */
3
4 #ifndef _LDAP_SHA1_H_
5 #define _LDAP_SHA1_H_
6
7 #include <ldap_cdefs.h>
8
9 LDAP_BEGIN_DECL
10
11 /*
12  * SHA-1 in C
13  * By Steve Reid <steve@edmweb.com>
14  * 100% Public Domain
15  */
16
17 /* XXX   I wonder if this will work on 64bit architectures... */
18 #ifndef LDAP_UINT32
19 #define LDAP_UINT32
20 typedef unsigned long uint32;
21 #endif
22
23 typedef struct {
24     uint32 state[5];
25     uint32 count[2];  
26     unsigned char buffer[64];
27 } ldap_SHA1_CTX;
28   
29 LDAP_F void ldap_SHA1Transform
30         LDAP_P((uint32 state[5], const unsigned char buffer[64]));
31
32 LDAP_F void ldap_SHA1Init
33         LDAP_P((ldap_SHA1_CTX *context));
34
35 LDAP_F void ldap_SHA1Update
36         LDAP_P((ldap_SHA1_CTX *context, const unsigned char *data, u_int len));
37
38 LDAP_F void ldap_SHA1Final
39         LDAP_P((unsigned char digest[20], ldap_SHA1_CTX *context));
40
41 LDAP_F char *ldap_SHA1End
42         LDAP_P((ldap_SHA1_CTX *, char *));
43
44 LDAP_F char *ldap_SHA1File
45         LDAP_P((char *, char *));
46
47 LDAP_F char *ldap_SHA1Data
48         LDAP_P((const unsigned char *, size_t, char *));
49
50 LDAP_END_DECL
51
52 #endif _LDAP_SHA1_H_