1 /* 2 * SHA-1 in C 3 * By Steve Reid <sreid (at) sea-to-sky.net> 4 * 100% Public Domain 5 * 6 */ 7 8 // Ported to C++, Google style and uses basictypes.h 9 10 #ifndef TALK_BASE_SHA1_H_ 11 #define TALK_BASE_SHA1_H_ 12 13 #include "talk/base/basictypes.h" 14 15 struct SHA1_CTX { 16 uint32 state[5]; 17 // TODO: Change bit count to uint64. 18 uint32 count[2]; // Bit count of input. 19 uint8 buffer[64]; 20 }; 21 22 #define SHA1_DIGEST_SIZE 20 23 24 void SHA1Init(SHA1_CTX* context); 25 void SHA1Update(SHA1_CTX* context, const uint8* data, size_t len); 26 void SHA1Final(SHA1_CTX* context, uint8 digest[SHA1_DIGEST_SIZE]); 27 28 #endif // TALK_BASE_SHA1_H_ 29