ext/digest/sha1/sha1.h


DEFINITIONS

This source file includes following functions.


   1  /*      $NetBSD: sha1.h,v 1.2 1998/05/29 22:55:44 thorpej Exp $ */
   2  /*      $RoughId: sha1.h,v 1.3 2002/02/24 08:14:32 knu Exp $    */
   3  /*      $Id: sha1.h,v 1.2 2002/02/24 08:20:22 knu Exp $ */
   4  
   5  /*
   6   * SHA-1 in C
   7   * By Steve Reid <steve@edmweb.com>
   8   * 100% Public Domain
   9   */
  10  
  11  #ifndef _SYS_SHA1_H_
  12  #define _SYS_SHA1_H_
  13  
  14  #include "defs.h"
  15  
  16  typedef struct {
  17          uint32_t state[5];
  18          uint32_t count[2];  
  19          uint8_t buffer[64];
  20  } SHA1_CTX;
  21  
  22  #ifdef RUBY
  23  #define SHA1_Transform  rb_Digest_SHA1_Transform
  24  #define SHA1_Init       rb_Digest_SHA1_Init
  25  #define SHA1_Update     rb_Digest_SHA1_Update
  26  #define SHA1_Final      rb_Digest_SHA1_Final
  27  #define SHA1_Equal      rb_Digest_SHA1_Equal
  28  #ifndef _KERNEL
  29  #define SHA1_End        rb_Digest_SHA1_End
  30  #define SHA1_File       rb_Digest_SHA1_File
  31  #define SHA1_Data       rb_Digest_SHA1_Data
  32  #endif /* _KERNEL */
  33  #endif
  34  
  35  void    SHA1_Transform _((uint32_t state[5], const uint8_t buffer[64]));
  36  void    SHA1_Init _((SHA1_CTX *context));
  37  void    SHA1_Update _((SHA1_CTX *context, const uint8_t *data, size_t len));
  38  void    SHA1_Final _((uint8_t digest[20], SHA1_CTX *context));
  39  int     SHA1_Equal _((SHA1_CTX *pctx1, SHA1_CTX *pctx2));
  40  #ifndef _KERNEL
  41  char    *SHA1_End _((SHA1_CTX *, char *));
  42  char    *SHA1_File _((char *, char *));
  43  char    *SHA1_Data _((const uint8_t *, size_t, char *));
  44  #endif /* _KERNEL */
  45  
  46  #define SHA1_BLOCK_LENGTH               64
  47  #define SHA1_DIGEST_LENGTH              20
  48  #define SHA1_DIGEST_STRING_LENGTH       (SHA1_DIGEST_LENGTH * 2 + 1)
  49    
  50  #endif /* _SYS_SHA1_H_ */