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"
10#include <iostream>
11
12namespace bb::crypto {
13
23template <typename Curve>
26{
27 const auto generators = context.generators->get(inputs.size(), context.offset, context.domain_separator);
28 Element result = Group::point_at_infinity;
29
30 for (size_t i = 0; i < inputs.size(); ++i) {
31 result += Element(generators[i]) * static_cast<uint256_t>(inputs[i]);
32 }
33 return result.normalize();
34}
36} // namespace bb::crypto
Performs pedersen commitments!
Definition pedersen.hpp:27
typename Curve::Element Element
Definition pedersen.hpp:30
static AffineElement commit_native(const std::vector< Fq > &inputs, GeneratorContext context={})
Given a vector of fields, generate a pedersen commitment using the indexed generators.
Definition pedersen.cpp:24
typename crypto::GeneratorContext< Curve > GeneratorContext
Definition pedersen.hpp:34
typename Group::affine_element AffineElement
Definition grumpkin.hpp:56
StrictMock< MockContext > context
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Curve::Element Element