luat_md5.h 699 B

123456789101112131415161718192021222324252627
  1. // code from https://github.com/galenguyer/md5 licensed under the Unlicense
  2. #define MD5_HASH_SIZE 16
  3. struct md5_context {
  4. // state
  5. unsigned int a;
  6. unsigned int b;
  7. unsigned int c;
  8. unsigned int d;
  9. // number of bits, modulo 2^64 (lsb first)
  10. unsigned int count[2];
  11. // input buffer
  12. unsigned char input[64];
  13. // current block
  14. unsigned int block[16];
  15. };
  16. struct md5_digest {
  17. unsigned char bytes[MD5_HASH_SIZE];
  18. };
  19. void luat_md5_init(struct md5_context *ctx);
  20. void luat_md5_update(struct md5_context* ctx, const void* buffer, uint32_t buffer_size);
  21. void luat_md5_finalize(struct md5_context* ctx, struct md5_digest* digest);
  22. //char* md5(const char* input);