You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
598 B

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