Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
utils.cpp
Go to the documentation of this file.
1#include "./utils.hpp"
2
3namespace bb::utils {
4
5std::vector<uint8_t> hex_to_bytes(const std::string& hex)
6{
7 std::vector<uint8_t> bytes;
8 bytes.reserve(hex.length() / 2);
9
10 for (unsigned int i = 0; i < hex.length(); i += 2) {
11 std::string byteString = hex.substr(i, 2);
12 bytes.push_back(static_cast<uint8_t>(strtol(byteString.c_str(), nullptr, 16)));
13 }
14
15 return bytes;
16}
17
18} // namespace bb::utils
std::vector< uint8_t > hex_to_bytes(const std::string &hex)
Routine to transform hexstring to vector of bytes.
Definition utils.cpp:5