1 #ifndef MY_MD5_INCLUDED
2 #define MY_MD5_INCLUDED
3 
4 /* Copyright (c) 2000, 2021, Oracle and/or its affiliates.
5 
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License, version 2.0,
8    as published by the Free Software Foundation.
9 
10    This program is also distributed with certain software (including
11    but not limited to OpenSSL) that is licensed under separate terms,
12    as designated in a particular file or component or in included license
13    documentation.  The authors of MySQL hereby grant you an additional
14    permission to link the program and your derivative works with the
15    separately licensed software that they have included with MySQL.
16 
17    This program is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20    GNU General Public License, version 2.0, for more details.
21 
22    You should have received a copy of the GNU General Public License
23    along with this program; if not, write to the Free Software
24    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
25 
26 #include "m_string.h"
27 #include "my_md5_size.h"
28 
29 /*
30   Wrapper function for MD5 implementation.
31 */
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 void compute_md5_hash(char *digest, const char *buf, int len);
37 
38 /*
39   Convert an array of bytes to a hexadecimal representation.
40 
41   Used to generate a hexadecimal representation of a message digest.
42 */
array_to_hex(char * to,const unsigned char * str,uint len)43 static inline void array_to_hex(char *to, const unsigned char *str, uint len)
44 {
45   const unsigned char *str_end= str + len;
46   for (; str != str_end; ++str)
47   {
48     *to++= _dig_vec_lower[((uchar) *str) >> 4];
49     *to++= _dig_vec_lower[((uchar) *str) & 0x0F];
50   }
51 }
52 #ifdef WITH_WSREP
53 void *wsrep_md5_init();
54 void wsrep_md5_update(void *ctx, char* buf, int len);
55   void wsrep_compute_md5_hash(char *digest, void *ctx);
56 #endif
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif /* MY_MD5_INCLUDED */
62