1 #ifndef SHA_H 2 #define SHA_H 3 4 /* NIST Secure Hash Algorithm */ 5 /* heavily modified from Peter C. Gutmann's implementation */ 6 7 /* This code is in the public domain */ 8 9 /* Useful defines & typedefs */ 10 11 typedef unsigned char SHA_BYTE; /* an 8-bit quantity */ 12 #if defined(WIN16) || defined(__LP32__) 13 typedef unsigned long SHA_LONG; /* a 32-bit quantity */ 14 #elif defined(_CRAY) || defined(__ILP64__) 15 typedef unsigned short SHA_LONG; /* a 32-bit quantity -- I hope! */ 16 #else 17 typedef unsigned int SHA_LONG; /* assume 32-bit ints -- generally OK */ 18 #endif 19 20 #define SHA_BLOCKSIZE 64 21 #define SHA_DIGESTSIZE 20 22 23 typedef struct { 24 SHA_LONG digest[5]; /* message digest */ 25 SHA_LONG count_lo, count_hi; /* 64-bit bit count */ 26 SHA_LONG data[16]; /* SHA data buffer */ 27 int local; /* unprocessed amount in data */ 28 } SHA_INFO; 29 30 void sha_init(SHA_INFO *); 31 void sha_update(SHA_INFO *, SHA_BYTE *, int); 32 void sha_final(SHA_INFO *); 33 34 #endif /* SHA_H */