MCPcopy Create free account
hub / github.com/citp/BlockSci / ParseHex

Function ParseHex

tools/parser/block_processor.cpp:45–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45std::vector<unsigned char> ParseHex(const char* psz) {
46 // convert hex dump to vector
47 std::vector<unsigned char> vch;
48 while (true) {
49 while (isspace(*psz)) {
50 psz++;
51 }
52 signed char c = blocksci::HexDigit(*psz++);
53 if (c == static_cast<signed char>(-1)) {
54 break;
55 }
56 auto n = static_cast<unsigned char>(c << 4);
57 c = blocksci::HexDigit(*psz++);
58 if (c == static_cast<signed char>(-1)) {
59 break;
60 }
61 n |= c;
62 vch.push_back(n);
63 }
64 return vch;
65}
66
67BlockFileReaderBase::~BlockFileReaderBase() = default;
68

Callers 1

nextTxImpMethod · 0.85

Calls 1

HexDigitFunction · 0.85

Tested by

no test coverage detected