root/ext/digest/sha.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. SHA_CTX

   1 /* SHA.H - header file for SHA.C
   2  */
   3 #ifndef _SHA_H_
   4 #define _SHA_H_
   5 
   6 #include <gauche.h>
   7 #include <gauche/extend.h>
   8 #include <sys/types.h>
   9 
  10 #if !defined(HAVE_UINT32_T)
  11 typedef unsigned int uint32_t;
  12 #endif /*!HAVE_UINT32_T*/
  13 
  14 #if defined(HAVE_UINT64_T)
  15 #define HAVE64 1
  16 #endif
  17 
  18 /*
  19 * Define to 1 for FIPS 180.1 version (with extra rotate in prescheduling),
  20 * 0 for FIPS 180 version (with the mysterious "weakness" that the NSA
  21 * isn't talking about).
  22 */
  23 #define SHA_VERSION 1
  24 
  25 #define SHA_BLOCKBYTES 64
  26 #define SHA_BLOCKWORDS 16
  27 
  28 #define SHA_HASHBYTES 20
  29 #define SHA_HASHWORDS 5
  30 
  31 /* SHA context. */
  32 typedef struct SHAContext {
  33  unsigned int key[SHA_BLOCKWORDS];
  34  uint32_t iv[SHA_HASHWORDS];
  35 #if defined(HAVE64)
  36  uint64_t bytes;
  37 #else
  38  uint32_t bytesHi, bytesLo;
  39 #endif
  40 } SHA_CTX;
  41 
  42 extern void   SHAInit(SHA_CTX *);
  43 extern void   SHAUpdate(SHA_CTX *, const unsigned char *, unsigned int);
  44 extern void   SHAFinal(unsigned char [SHA_HASHBYTES], SHA_CTX *);
  45 extern char * SHAEnd(SHA_CTX *, char *);
  46 extern char * SHAFile(const char *, char *);
  47 extern char * SHAData(const unsigned char *, unsigned int, char *);
  48 
  49 #endif /* _SHA_H_ */

/* [<][>][^][v][top][bottom][index][help] */