Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
data_store.cpp
Go to the documentation of this file.
1#include "data_store.hpp"
2#include <cstring>
3#include <fstream>
4#include <ios>
5#include <map>
6#include <string>
7#include <vector>
8// #include <barretenberg/common/log.hpp>
9
10namespace {
12}
13
14extern "C" {
15
16void set_data(char const* key, uint8_t const* addr, size_t length)
17{
18 std::string k = key;
19 store[k] = std::vector<uint8_t>(addr, addr + length);
20 // info("set data: ", key, " length: ", length, " hash: ", crypto::sha256(store[k]));
21 // std::ofstream file("/mnt/user-data/charlie/debugging/x86_" + k, std::ios::binary);
22 // file.write(reinterpret_cast<const char*>(addr), (std::streamsize)length);
23}
24
25void get_data(char const* key, uint8_t* out_buf)
26{
27 std::string k = key;
28 if (store.contains(key)) {
29 // info("get data hit: ", key, " length: ", *length_out, " ptr ", (void*)ptr);
30 std::memcpy(out_buf, store[k].data(), store[k].size());
31 }
32 // info("get data miss: ", key);
33 // return nullptr;
34}
35}
const std::vector< FF > data
void get_data(char const *key, uint8_t *out_buf)
void set_data(char const *key, uint8_t const *addr, size_t length)
uint8_t const size_t length
Definition data_store.hpp:9
uint8_t * out_buf
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13