md5.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef __MD5_H__
  2. #define __MD5_H__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /**
  7. * \brief MD5 context structure
  8. */
  9. typedef struct
  10. {
  11. unsigned long total[2]; /*!< number of bytes processed */
  12. unsigned long state[4]; /*!< intermediate digest state */
  13. unsigned char buffer[64]; /*!< data block being processed */
  14. }
  15. md5_context;
  16. /**
  17. * \brief MD5 context setup
  18. *
  19. * \param ctx context to be initialized
  20. */
  21. void md5_starts(md5_context* ctx);
  22. /**
  23. * \brief MD5 process buffer
  24. *
  25. * \param ctx MD5 context
  26. * \param input buffer holding the data
  27. * \param ilen length of the input data
  28. */
  29. void md5_update(md5_context* ctx, const unsigned char* input, int ilen);
  30. /**
  31. * \brief MD5 final digest
  32. *
  33. * \param ctx MD5 context
  34. * \param output MD5 checksum result
  35. */
  36. void md5_finish(md5_context* ctx, unsigned char output[16]);
  37. /**
  38. * \brief Output = MD5( input buffer )
  39. *
  40. * \param input buffer holding the data
  41. * \param ilen length of the input data
  42. * \param output MD5 checksum result
  43. */
  44. void md5(unsigned char* input, int ilen, unsigned char output[16]);
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif