// Copyright (c) 2019-2021 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include #include #include #include #include #include #include #include #include #include #include #include #include FUZZ_TARGET(hex) { const std::string random_hex_string(buffer.begin(), buffer.end()); const std::vector data = ParseHex(random_hex_string); const std::vector bytes{ParseHex(random_hex_string)}; assert(std::ranges::equal(AsBytes(Span{data}), bytes)); const std::string hex_data = HexStr(data); if (IsHex(random_hex_string)) { assert(ToLower(random_hex_string) == hex_data); } if (uint256::FromHex(random_hex_string)) { assert(random_hex_string.length() == 64); assert(Txid::FromHex(random_hex_string)); assert(Wtxid::FromHex(random_hex_string)); assert(uint256::FromUserHex(random_hex_string)); } if (const auto result{uint256::FromUserHex(random_hex_string)}) { assert(uint256::FromHex(result->ToString())); } (void)uint256S(random_hex_string); try { (void)HexToPubKey(random_hex_string); } catch (const UniValue&) { } CBlockHeader block_header; (void)DecodeHexBlockHeader(block_header, random_hex_string); CBlock block; (void)DecodeHexBlk(block, random_hex_string); }