home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ldapsdk.zip / include / lutil_sha1.h < prev    next >
C/C++ Source or Header  |  2001-06-02  |  2KB  |  70 lines

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