MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
my_md5.h
1 #ifndef MY_MD5_INCLUDED
2 #define MY_MD5_INCLUDED
3 
4 /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
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 as published by
8  the Free Software Foundation; version 2 of the License.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
18 
19 #include "m_string.h"
20 
21 #define MD5_HASH_SIZE 16 /* Hash size in bytes */
22 
23 /*
24  Wrapper function for MD5 implementation.
25 */
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 void compute_md5_hash(char *digest, const char *buf, int len);
31 
32 /*
33  Convert an array of bytes to a hexadecimal representation.
34 
35  Used to generate a hexadecimal representation of a message digest.
36 */
37 static inline void array_to_hex(char *to, const unsigned char *str, uint len)
38 {
39  const unsigned char *str_end= str + len;
40  for (; str != str_end; ++str)
41  {
42  *to++= _dig_vec_lower[((uchar) *str) >> 4];
43  *to++= _dig_vec_lower[((uchar) *str) & 0x0F];
44  }
45 }
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 
51 #endif /* MY_MD5_INCLUDED */