md5.h 697 B

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