MCPcopy Create free account
hub / github.com/MeisApps/pcbu-desktop / FromHexString

Method FromHexString

common/src/utils/StringUtils.cpp:96–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96std::vector<uint8_t> StringUtils::FromHexString(const std::string& hex) {
97 std::vector<uint8_t> result{};
98 result.reserve((hex.size() + 1) / 2);
99 try {
100 boost::algorithm::unhex(hex.begin(), hex.end(), std::back_inserter(result));
101 } catch (const boost::algorithm::hex_decode_error&) {
102 return {};
103 }
104 return result;
105}
106
107std::string StringUtils::ToHexString(const std::vector<uint8_t> &data) {
108 std::string hex;

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected