#ifndef SHA1_H #define SHA1_H #endif #define SHA1_ALGORITHM_BYTE 2 /* SHA1 message digest algorithm */ #ifndef MD5_H #ifdef __alpha typedef unsigned int uint32; #else typedef unsigned long uint32; #endif #endif typedef union longbyte { uint32 W[80]; /* Process 16 32-bit words at a time */ char B[320]; /* But read them as bytes for counting */ } lbyte; struct SHA1Context { uint32 h0, h1, h2, h3, h4; /* accumulators for message digest */ uint32 hi_length, lo_length; int inbytes, padded; lbyte in; /* serves double duty: if inbytes = 0 serves as scratchpad for SHA1 calculation (all 320 bytes used); otherwise holds inbytes (< 64) left over bytes waiting for more bytes to be added to the digest calculation */ }; typedef struct SHA1Context SHA1_CTX; extern int mdalg_flag; void SHA1Init(struct SHA1Context *context); int SHA1Update0(struct SHA1Context *context, unsigned char const **buf, unsigned *len, int finalize); void SHA1Update(struct SHA1Context *context, unsigned char const *buf, unsigned len); void SHA1Final(unsigned char digest[16], struct SHA1Context *context); int SHA1file0_len(struct SHA1Context *shContext, FILE * f, word32 longcount); int SHA1file(struct SHA1Context *shContext, char *filename); void SHA1_addbuffer(struct SHA1Context *shContext, byte * buf, int buflen, byte digest[20]);