md5.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * This is an OpenSSL-compatible implementation of the RSA Data Security,
  3. * Inc. MD5 Message-Digest Algorithm.
  4. *
  5. * Written by Solar Designer <solar@openwall.com> in 2001, and placed in
  6. * the public domain. See md5.c for more information.
  7. */
  8. #ifndef _MD5_H
  9. #define _MD5_H
  10. #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
  11. #define MD5_LONG unsigned long
  12. #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
  13. #define MD5_LONG unsigned long
  14. #define MD5_LONG_LOG2 3
  15. /*
  16. * _CRAY note. I could declare short, but I have no idea what impact
  17. * does it have on performance on none-T3E machines. I could declare
  18. * int, but at least on C90 sizeof(int) can be chosen at compile time.
  19. * So I've chosen long...
  20. * <appro@fy.chalmers.se>
  21. */
  22. #else
  23. #define MD5_LONG unsigned int
  24. #endif
  25. #define MD5_CBLOCK 64
  26. #define MD5_LBLOCK (MD5_CBLOCK/4)
  27. #define MD5_DIGEST_LENGTH 16
  28. typedef struct MD5state_st
  29. {
  30. MD5_LONG A,B,C,D;
  31. MD5_LONG Nl,Nh;
  32. MD5_LONG data[MD5_LBLOCK];
  33. int num;
  34. } MD5_CTX;
  35. int MD5_Init(MD5_CTX *c);
  36. int MD5_Update(MD5_CTX *c, const void *data, unsigned long len);
  37. int MD5_Final(unsigned char *md, MD5_CTX *c);
  38. //unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);
  39. void MD5_Transform(MD5_CTX *c, const unsigned char *b);
  40. #endif /* !_MD5_H */