rc-md5.c 661 B

1234567891011121314151617181920212223242526272829
  1. /* MD5 message-digest algorithm */
  2. /* This file is licensed under the BSD License, but is largely derived from
  3. * public domain source code
  4. */
  5. /*
  6. * FORCE MD5 TO USE OUR MD5 HEADER FILE!
  7. *
  8. * If we don't do this, it might pick up the systems broken MD5.
  9. */
  10. #include "rc-md5.h"
  11. /** Hash the provided data using MD5
  12. *
  13. * @param[out] output will hold a 16-byte checksum.
  14. * @param[in] input pointer to data to hash.
  15. * @param[in] inlen the length of input.
  16. */
  17. void rc_md5_calc(unsigned char *output, unsigned char const *input,
  18. size_t inlen)
  19. {
  20. MD5_CTX context;
  21. MD5Init(&context);
  22. MD5Update(&context, input, inlen);
  23. MD5Final(output, &context);
  24. }