17 #include "../verifierutils.hpp"
20 using namespace verifierUtils;
38 for (
int i =
bytes.size()-1; i>=0; i--)
40 bytes[i] = number.get_ui() % 0x100;
41 number = number / 0x100;
48 if ((s.compare(0,2,
"01") != 0) || (s.size()%2 !=0))
50 std::cout<<
"ERROR: in Leaf(string), input does not "
51 "start with '01' or has an odd length"
52 <<std::endl<<
"input: '"<<s<<
"'"<<std::endl;
59 if ((10+l*2) > s.size())
61 std::cout<<
"ERROR in Leaf::Leaf(string): the "
62 "input is too small! Input: "<<s
70 for (
unsigned int i=0; i < l; i++)
74 s = s.substr(10+l*2,std::string::npos);
89 std::vector<uint8_t> byteRepresentation =
toVector();
90 for (
unsigned int i=0; i<byteRepresentation.size(); i++)
91 result +=
byte2str(byteRepresentation[i]);
98 std::vector<uint8_t> result;
101 uint32_t byteNumber =
bytes.size();
102 result.push_back((byteNumber>>24) % 0x100);
103 result.push_back((byteNumber>>16) % 0x100);
104 result.push_back((byteNumber>> 8) % 0x100);
105 result.push_back( byteNumber % 0x100);
107 result.insert(result.end(),
bytes.begin(),
bytes.end());
125 mpz_class result = 0;
126 for (
unsigned int i=0; i<
bytes.size(); i++)
127 result = (result * 0x100) +
bytes[i];
134 std::vector<bool> result(
bytes.size());
135 for (
unsigned int i=0; i<
bytes.size(); i++)
136 result[i] = (
bytes[i] == 1);
150 for (
unsigned int i=0; i<
bytes.size(); i++)
152 std::cout<<std::endl;
158 bool different = (s.size() !=
bytes.size());
163 for (
unsigned int i=0; i < s.size(); i++)
164 if ((uint8_t)s[i] !=
bytes[i])