Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
pedersen.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 "pedersen.hpp"
8#include "../../hash/pedersen/pedersen.hpp"
10
11namespace bb::stdlib {
12
13template <typename C>
15{
16
18
19 const auto base_points = context.generators->get(inputs.size(), context.offset, context.domain_separator);
20
23 for (size_t i = 0; i < inputs.size(); ++i) {
24 scalars.emplace_back(cycle_scalar::create_from_bn254_scalar(inputs[i]));
25 // constructs circuit-constant cycle_group objects (non-witness)
26 points.emplace_back(base_points[i]);
27 }
28
29 return cycle_group::batch_mul(points, scalars);
30}
31
32template <typename C>
34{
35
38 for (auto& [scalar, context] : input_pairs) {
39 scalars.emplace_back(cycle_scalar::create_from_bn254_scalar(scalar));
40 // constructs constant cycle_group objects (non-witness)
41 points.emplace_back(context.generators->get(1, context.offset, context.domain_separator)[0]);
42 }
43
44 return cycle_group::batch_mul(points, scalars);
45}
46
49
50} // namespace bb::stdlib
cycle_group represents a group Element of the proving system's embedded curve i.e....
::bb::stdlib::cycle_scalar< Builder > cycle_scalar
static cycle_group batch_mul(const std::vector< cycle_group > &base_points, const std::vector< BigScalarField > &scalars, GeneratorContext context={})
static cycle_scalar create_from_bn254_scalar(const field_t &_in, bool skip_primality_test=false)
Use when we want to multiply a group element by a string of bits of known size. N....
typename stdlib::cycle_group< CircuitBuilder >::cycle_scalar cycle_scalar
Definition pedersen.hpp:21
static cycle_group commit(const std::vector< field_t > &inputs, GeneratorContext context={})
Definition pedersen.cpp:14
StrictMock< MockContext > context
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13