MySQL 8.0.40
Source Code Documentation
digest.h
Go to the documentation of this file.
1#ifndef DIGEST_INCLUDED
2#define DIGEST_INCLUDED
3/* Copyright (c) 2017, 2024, Oracle and/or its affiliates.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License, version 2.0,
7 as published by the Free Software Foundation.
8
9 This program is designed to work with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation. The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have either included with
15 the program or referenced in the documentation.
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 St, Fifth Floor, Boston, MA 02110-1301 USA */
25
26/**
27 @file storage/perfschema/digest.h
28 Constants and functionality that facilitate working with digests.
29*/
30
31/**
32 Write SHA-256 hash value in a string to be used
33 as DIGEST for the statement.
34*/
35#define DIGEST_HASH_TO_STRING(_hash, _str) \
36 (void)sprintf(_str, \
37 "%02x%02x%02x%02x%02x%02x%02x%02x" \
38 "%02x%02x%02x%02x%02x%02x%02x%02x" \
39 "%02x%02x%02x%02x%02x%02x%02x%02x" \
40 "%02x%02x%02x%02x%02x%02x%02x%02x", \
41 _hash[0], _hash[1], _hash[2], _hash[3], _hash[4], _hash[5], \
42 _hash[6], _hash[7], _hash[8], _hash[9], _hash[10], _hash[11], \
43 _hash[12], _hash[13], _hash[14], _hash[15], _hash[16], \
44 _hash[17], _hash[18], _hash[19], _hash[20], _hash[21], \
45 _hash[22], _hash[23], _hash[24], _hash[25], _hash[26], \
46 _hash[27], _hash[28], _hash[29], _hash[30], _hash[31])
47
48/// SHA-256 = 32 bytes of binary = 64 printable characters.
49#define DIGEST_HASH_TO_STRING_LENGTH 64
50
51#endif // DIGEST_INCLUDED