#include #include #include #include #include #include #include #include #include "util.h" namespace libzerocash { void convertBytesVectorToVector(const std::vector& bytes, std::vector& v) { v.resize(bytes.size() * 8); unsigned char c; for (size_t i = 0; i < bytes.size(); i++) { c = bytes.at(i); for (size_t j = 0; j < 8; j++) { v.at((i*8)+j) = (c >> (7-j)) & 1; } } } uint64_t convertVectorToInt(const std::vector& v) { if (v.size() > 64) { throw std::length_error ("boolean vector can't be larger than 64 bits"); } uint64_t result = 0; for (size_t i=0; i