md5.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef MD5_H_
  2. #define MD5_H_
  3. #include <stddef.h>
  4. #include <stdint.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. /**
  9. * \brief MD5 context structure
  10. */
  11. typedef struct
  12. {
  13. uint32_t total[2]; /*!< number of bytes processed */
  14. uint32_t state[4]; /*!< intermediate digest state */
  15. unsigned char buffer[64]; /*!< data block being processed */
  16. } mbedtls_md5_context;
  17. /**
  18. * \brief Initialize MD5 context
  19. *
  20. * \param ctx MD5 context to be initialized
  21. */
  22. void mbedtls_md5_init( mbedtls_md5_context *ctx );
  23. /**
  24. * \brief Clone (the state of) an MD5 context
  25. *
  26. * \param dst The destination context
  27. * \param src The context to be cloned
  28. */
  29. void mbedtls_md5_clone( mbedtls_md5_context *dst,
  30. const mbedtls_md5_context *src );
  31. /**
  32. * \brief MD5 context setup
  33. *
  34. * \param ctx context to be initialized
  35. */
  36. void mbedtls_md5_starts( mbedtls_md5_context *ctx );
  37. /**
  38. * \brief MD5 process buffer
  39. *
  40. * \param ctx MD5 context
  41. * \param input buffer holding the data
  42. * \param ilen length of the input data
  43. */
  44. void mbedtls_md5_update( mbedtls_md5_context *ctx, const unsigned char *input, size_t ilen );
  45. /**
  46. * \brief MD5 final digest
  47. *
  48. * \param ctx MD5 context
  49. * \param output MD5 checksum result
  50. */
  51. void mbedtls_md5_finish( mbedtls_md5_context *ctx, unsigned char output[16] );
  52. /* Internal use */
  53. void mbedtls_md5_process( mbedtls_md5_context *ctx, const unsigned char data[64] );
  54. /**
  55. * \brief Output = MD5( input buffer )
  56. *
  57. * \param input buffer holding the data
  58. * \param ilen length of the input data
  59. * \param output MD5 checksum result
  60. */
  61. void mbedtls_md5( const unsigned char *input, size_t ilen, unsigned char output[16] );
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /*MD5_H_*/