Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1#pragma once
2#include <bitset>
3#include <iostream>
4
5std::string bytes_to_hex_string(const std::vector<uint8_t>& input)
6{
7 static const char characters[] = "0123456789ABCDEF";
8
9 // Zeroes out the buffer unnecessarily, can't be avoided for std::string.
10 std::string ret(input.size() * 2, 0);
11
12 // Hack... Against the rules but avoids copying the whole buffer.
13 auto buf = const_cast<char*>(ret.data());
14
15 for (const auto& oneInputByte : input) {
16 *buf++ = characters[oneInputByte >> 4];
17 *buf++ = characters[oneInputByte & 0x0F];
18 }
19 return ret;
20}
uint8_t const * buf
Definition data_store.hpp:9
std::string bytes_to_hex_string(const std::vector< uint8_t > &input)
Definition utils.hpp:5