service_md5.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef MYSQL_SERVICE_MD5_INCLUDED
  2. /* Copyright (c) 2014, Monty Program Ab
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; version 2 of the License.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
  13. /**
  14. @file
  15. my md5 service
  16. Functions to calculate MD5 hash from a memory buffer
  17. */
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #ifndef MYSQL_ABI_CHECK
  22. #include <stdlib.h>
  23. #endif
  24. #define MY_MD5_HASH_SIZE 16 /* Hash size in bytes */
  25. extern struct my_md5_service_st {
  26. void (*my_md5_type)(unsigned char*, const char*, size_t);
  27. void (*my_md5_multi_type)(unsigned char*, ...);
  28. size_t (*my_md5_context_size_type)();
  29. void (*my_md5_init_type)(void *);
  30. void (*my_md5_input_type)(void *, const unsigned char *, size_t);
  31. void (*my_md5_result_type)(void *, unsigned char *);
  32. } *my_md5_service;
  33. #ifdef MYSQL_DYNAMIC_PLUGIN
  34. #define my_md5(A,B,C) my_md5_service->my_md5_type(A,B,C)
  35. #define my_md5_multi my_md5_service->my_md5_multi_type
  36. #define my_md5_context_size() my_md5_service->my_md5_context_size_type()
  37. #define my_md5_init(A) my_md5_service->my_md5_init_type(A)
  38. #define my_md5_input(A,B,C) my_md5_service->my_md5_input_type(A,B,C)
  39. #define my_md5_result(A,B) my_md5_service->my_md5_result_type(A,B)
  40. #else
  41. void my_md5(unsigned char*, const char*, size_t);
  42. void my_md5_multi(unsigned char*, ...);
  43. size_t my_md5_context_size();
  44. void my_md5_init(void *context);
  45. void my_md5_input(void *context, const unsigned char *buf, size_t len);
  46. void my_md5_result(void *context, unsigned char *digest);
  47. #endif
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #define MYSQL_SERVICE_MD5_INCLUDED
  52. #endif