mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
Move HexStr and HexDigit functions from util to crypto. The crypto library does not actually use these functions, but the consensus library does. The consensus and util libraries not allowed to depend on each other, but are allowed to depend on the cryto library, so the crypto library is a reasonable put these. The consensus library uses HexStr and HexDigit in script.cpp, transaction.cpp, and uint256.cpp. The util library does not use HexStr but does use HexDigit in strencodings.cpp to parse integers.
24 lines
714 B
C++
24 lines
714 B
C++
// Copyright (c) 2009-present The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_CRYPTO_HEX_BASE_H
|
|
#define BITCOIN_CRYPTO_HEX_BASE_H
|
|
|
|
#include <span.h>
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
/**
|
|
* Convert a span of bytes to a lower-case hexadecimal string.
|
|
*/
|
|
std::string HexStr(const Span<const uint8_t> s);
|
|
inline std::string HexStr(const Span<const char> s) { return HexStr(MakeUCharSpan(s)); }
|
|
inline std::string HexStr(const Span<const std::byte> s) { return HexStr(MakeUCharSpan(s)); }
|
|
|
|
signed char HexDigit(char c);
|
|
|
|
#endif // BITCOIN_CRYPTO_HEX_BASE_H
|