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
9 for (unsigned int i = 0; i < hex.length(); i += 2) {
10 std::string byteString = hex.substr(i, 2);
11 bytes.push_back(static_cast<uint8_t>(strtol(byteString.c_str(), nullptr, 16)));
12 }
13
14 return bytes;
15}
16
17} // 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