Bitcoin Core  31.0.0
P2P Digital Currency
hex_base.h
Go to the documentation of this file.
1 // Copyright (c) 2009-present The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_CRYPTO_HEX_BASE_H
6 #define BITCOIN_CRYPTO_HEX_BASE_H
7 
8 #include <span.h>
9 
10 #include <cstddef>
11 #include <cstdint>
12 #include <span>
13 #include <string>
14 
18 std::string HexStr(std::span<const uint8_t> s);
19 inline std::string HexStr(std::span<const char> s) { return HexStr(MakeUCharSpan(s)); }
20 inline std::string HexStr(std::span<const std::byte> s) { return HexStr(MakeUCharSpan(s)); }
21 
22 signed char HexDigit(char c);
23 
24 #endif // BITCOIN_CRYPTO_HEX_BASE_H
constexpr auto MakeUCharSpan(const V &v) -> decltype(UCharSpanCast(std::span
Like the std::span constructor, but for (const) unsigned char member types only.
Definition: span.h:111
std::string HexStr(std::span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
Definition: hex_base.cpp:30
signed char HexDigit(char c)
Definition: hex_base.cpp:64