Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / openldap / dist / include / lutil_sha1.h
blobb93136d60f50f4a3926c64ec390971a3925220cb
1 /* $OpenLDAP: pkg/ldap/include/lutil_sha1.h,v 1.28.2.3 2008/02/11 23:26:40 kurt Exp $ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1998-2008 The OpenLDAP Foundation.
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
9 * Public License.
11 * A copy of this license is available in file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
16 /* This version is based on:
17 * $OpenBSD: sha1.h,v 1.8 1997/07/15 01:54:23 millert Exp $ */
19 #ifndef _LUTIL_SHA1_H_
20 #define _LUTIL_SHA1_H_
22 #include <ldap_cdefs.h>
23 #include <ac/bytes.h>
25 #ifdef AC_INT4_TYPE
27 LDAP_BEGIN_DECL
31 * SHA-1 in C
32 * By Steve Reid <steve@edmweb.com>
34 #define LUTIL_SHA1_BYTES 20
36 /* This code assumes char are 8-bits and uint32 are 32-bits */
37 typedef ac_uint4 uint32;
39 typedef struct {
40 uint32 state[5];
41 uint32 count[2];
42 unsigned char buffer[64];
43 } lutil_SHA1_CTX;
45 LDAP_LUTIL_F( void )
46 lutil_SHA1Transform
47 LDAP_P((uint32 state[5], const unsigned char buffer[64]));
49 LDAP_LUTIL_F( void )
50 lutil_SHA1Init
51 LDAP_P((lutil_SHA1_CTX *context));
53 LDAP_LUTIL_F( void )
54 lutil_SHA1Update
55 LDAP_P((lutil_SHA1_CTX *context, const unsigned char *data, uint32 len));
57 LDAP_LUTIL_F( void )
58 lutil_SHA1Final
59 LDAP_P((unsigned char digest[20], lutil_SHA1_CTX *context));
61 LDAP_LUTIL_F( char * )
62 lutil_SHA1End
63 LDAP_P((lutil_SHA1_CTX *, char *));
65 LDAP_LUTIL_F( char * )
66 lutil_SHA1File
67 LDAP_P((char *, char *));
69 LDAP_LUTIL_F( char * )
70 lutil_SHA1Data
71 LDAP_P((const unsigned char *, size_t, char *));
73 LDAP_END_DECL
75 #endif /* AC_INT4_TYPE */
77 #endif /* _LUTIL_SHA1_H_ */