00001 00006 #ifndef _SHA1_H 00007 #define _SHA1_H 00008 00009 #ifdef __cplusplus 00010 extern "C" { 00011 #endif 00012 00020 #define SHA1_BLOCK_LENGTH 64 00021 #define SHA1_DIGEST_LENGTH 20 00022 #define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1) 00023 00024 typedef struct { 00025 uint32_t state[5]; 00026 uint64_t count; 00027 uint8_t buffer[SHA1_BLOCK_LENGTH]; 00028 } SHA1_CTX; 00029 00030 void SHA1Init(SHA1_CTX *); 00031 void SHA1Pad(SHA1_CTX *); 00032 void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH]); 00033 void SHA1Update(SHA1_CTX *, const uint8_t *, size_t); 00034 void SHA1Final(uint8_t [SHA1_DIGEST_LENGTH], SHA1_CTX *); 00035 00038 #ifdef __cplusplus 00039 } 00040 #endif 00041 00042 #endif /* _SHA1_H */