MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / HexStr

Function HexStr

src/crypto/hex_base.cpp:30–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28} // namespace
29
30std::string HexStr(const std::span<const uint8_t> s)
31{
32 std::string rv(s.size() * 2, '\0');
33 static constexpr auto byte_to_hex = CreateByteToHexMap();
34 static_assert(sizeof(byte_to_hex) == 512);
35
36 char* it = rv.data();
37 for (uint8_t v : s) {
38 std::memcpy(it, byte_to_hex[v].data(), 2);
39 it += 2;
40 }
41
42 assert(it == rv.data() + rv.size());
43 return rv;
44}
45
46const signed char p_util_hexdigit[256] =
47{ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,

Callers

nothing calls this directly

Calls 3

CreateByteToHexMapFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected