Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
c_bind.cpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#include "../bn254/fr.hpp"
9
10using namespace bb;
11
12WASM_EXPORT void bn254_fr_sqrt(uint8_t const* input, uint8_t* result)
13{
14 using serialize::write;
15 auto input_fr = from_buffer<bb::fr>(input);
16 auto [is_sqr, root] = input_fr.sqrt();
17
18 uint8_t* is_sqrt_result_ptr = result;
19 uint8_t* root_result_ptr = result + 1;
20
21 write(is_sqrt_result_ptr, is_sqr);
22 write(root_result_ptr, root);
23}
24
25// NOLINTEND(cert-dcl37-c, cert-dcl51-cpp, bugprone-reserved-identifier)
WASM_EXPORT void bn254_fr_sqrt(uint8_t const *input, uint8_t *result)
Definition c_bind.cpp:12
Entry point for Barretenberg command-line interface.
void write(B &buf, field2< base_field, Params > const &value)
void write(auto &buf, const msgpack_concepts::HasMsgPack auto &obj)
Automatically derived write for any object that defines .msgpack() (implicitly defined by MSGPACK_FIE...
#define WASM_EXPORT