sha1.h 698 B

12345678910111213141516171819202122232425262728293031
  1. /* sha1.h */
  2. #ifndef SHA1_H
  3. #define SHA1_H
  4. #include "ustd.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. #define sha1_block_size 64
  9. #define sha1_hash_size 20
  10. /* algorithm context */
  11. typedef struct sha1_ctx
  12. {
  13. unsigned char message[sha1_block_size]; /* 512-bit buffer for leftovers */
  14. uint64_t length; /* number of processed bytes */
  15. unsigned hash[5]; /* 160-bit algorithm internal hashing state */
  16. } sha1_ctx;
  17. /* hash functions */
  18. void rhash_sha1_init(sha1_ctx *ctx);
  19. void rhash_sha1_update(sha1_ctx *ctx, const unsigned char* msg, size_t size);
  20. void rhash_sha1_final(sha1_ctx *ctx, unsigned char* result);
  21. #ifdef __cplusplus
  22. } /* extern "C" */
  23. #endif /* __cplusplus */
  24. #endif /* SHA1_H */