sha1.h 511 B

123456789101112131415161718192021
  1. /* public api for steve reid's public domain SHA-1 implementation */
  2. /* this file is in the public domain */
  3. #pragma once
  4. #include "Platform.h"
  5. struct SHA1_CTX {
  6. uint32_t state[5];
  7. uint32_t count[2];
  8. uint8_t buffer[64];
  9. };
  10. #define SHA1_DIGEST_SIZE 20
  11. void SHA1_Init(SHA1_CTX *context);
  12. void SHA1_Update(SHA1_CTX *context, const uint8_t *data, const size_t len);
  13. void SHA1_Final(SHA1_CTX *context, uint8_t digest[SHA1_DIGEST_SIZE]);
  14. void sha1_32a(const void *key, int len, uint32_t seed, void *out);