sha1.h 717 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef SHA1_H
  2. #define SHA1_H
  3. /*
  4. SHA-1 in C
  5. By Steve Reid <steve@edmweb.com>
  6. 100% Public Domain
  7. */
  8. #include "stdint.h"
  9. #if defined(__cplusplus)
  10. extern "C" {
  11. #endif
  12. typedef struct
  13. {
  14. uint32_t state[5];
  15. uint32_t count[2];
  16. unsigned char buffer[64];
  17. } SHA1_CTX;
  18. void SHA1Transform(
  19. uint32_t state[5],
  20. const unsigned char buffer[64]
  21. );
  22. void SHA1Init(
  23. SHA1_CTX * context
  24. );
  25. void SHA1Update(
  26. SHA1_CTX * context,
  27. const unsigned char *data,
  28. uint32_t len
  29. );
  30. void SHA1Final(
  31. unsigned char digest[20],
  32. SHA1_CTX * context
  33. );
  34. void SHA1(
  35. char *hash_out,
  36. const char *str,
  37. uint32_t len);
  38. #if defined(__cplusplus)
  39. }
  40. #endif
  41. #endif /* SHA1_H */