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