MySQL 9.0.0
Source Code Documentation
my_md5.h
Go to the documentation of this file.
1#ifndef MY_MD5_INCLUDED
2#define MY_MD5_INCLUDED
3
4/* Copyright (c) 2000, 2024, 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 designed to work 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 either included with
16 the program or referenced in the documentation.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License, version 2.0, for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26
27#include <sys/types.h>
28
29#include "dig_vec.h"
30#include "my_inttypes.h"
31
32/**
33 @file include/my_md5.h
34 Wrapper function for MD5 implementation.
35*/
36
37extern int compute_md5_hash(char *digest, const char *buf, size_t len);
38
39/*
40 Convert an array of bytes to a hexadecimal representation.
41
42 Used to generate a hexadecimal representation of a message digest.
43*/
44static inline void array_to_hex(char *to, const unsigned char *str, uint len) {
45 const unsigned char *str_end = str + len;
46 for (; str != str_end; ++str) {
47 *to++ = dig_vec_lower[((uchar)*str) >> 4];
48 *to++ = dig_vec_lower[((uchar)*str) & 0x0F];
49 }
50}
51
52#endif /* MY_MD5_INCLUDED */
constexpr std::array< const char, 37 > dig_vec_lower
Definition: dig_vec.h:36
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
int compute_md5_hash(char *digest, const char *buf, size_t len)
Wrapper function to compute MD5 message digest.
Definition: my_md5.cc:75
static void array_to_hex(char *to, const unsigned char *str, uint len)
Definition: my_md5.h:44
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1081
Definition: buf0block_hint.cc:30