45 unsigned begin = _begin;
46 unsigned end = _end < 0 ? _hexVector.size() + 1 + _end : _end;
47 bool odd = ((end - begin) % 2) != 0;
49 std::string ret(1, ((_leaf ? 2 : 0) | (odd ? 1 : 0)) * 16);
52 ret[0] |= _hexVector[begin];
55 for (
unsigned i = begin; i < end; i += 2)
56 ret += _hexVector[i] * 16 + _hexVector[i + 1];
62 unsigned begin = _beginNibble + _offset;
63 unsigned end = (_endNibble < 0 ? ((int)(_data.
size() * 2 - _offset) + 1) + _endNibble : _endNibble) + _offset;
64 bool odd = (end - begin) & 1;
66 std::string ret(1, ((_leaf ? 2 : 0) | (odd ? 1 : 0)) * 16);
67 ret.reserve((end - begin) / 2 + 1);
69 unsigned d = odd ? 1 : 2;
70 for (
auto i = begin; i < end; ++i, ++
d)
76 ret.push_back(n << 4);
83 unsigned begin1 = _o1;
84 unsigned end1 = _d1.
size() * 2;
85 unsigned begin2 = _o2;
86 unsigned end2 = _d2.
size() * 2;
88 bool odd = (end1 - begin1 + end2 - begin2) & 1;
90 std::string ret(1, ((_leaf ? 2 : 0) | (odd ? 1 : 0)) * 16);
91 ret.reserve((end1 - begin1 + end2 - begin2) / 2 + 1);
93 unsigned d = odd ? 1 : 2;
94 for (
auto i = begin1; i < end1; ++i, ++
d)
100 ret.push_back(n << 4);
102 for (
auto i = begin2; i < end2; ++i, ++
d)
108 ret.push_back(n << 4);
116 for (
unsigned i = 0; i < 17; ++i)
117 if (i != except && !_orig[i].isEmpty())
byte nibble(bytesConstRef _data, unsigned _i)
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
std::string hexPrefixEncode(bytes const &_hexVector, bool _leaf, int _begin, int _end)
std::vector< byte > bytes
byte uniqueInUse(RLP const &_orig, byte except)
Class for interpreting Recursive Linear-Prefix Data.