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