33template <
class Fq,
class Fr,
class Params>
class alignas(32)
element {
45 static constexpr
element one() noexcept {
return { Params::one_x, Params::one_y,
Fq::one() }; };
71 constexpr
element operator-() const noexcept;
111 std::span<const
Fr> scalars,
112 size_t max_num_bits = 0,
113 bool with_edgecases = true,
114 const
Fr& masking_scalar =
Fr(1)) noexcept
129 template <
typename =
typename std::enable_if<Params::can_hash_to_curve>>
155 uint64_t predicate) noexcept;
159 os <<
"{ " <<
a.x <<
", " <<
a.y <<
", " <<
a.z <<
" }";
166 return os <<
"x:" << e.
x <<
" y:" << e.
y <<
" z:" << e.
z;
static affine_element batch_mul(std::span< const affine_element > points, std::span< const Fr > scalars, size_t max_num_bits=0, bool with_edgecases=true, const Fr &masking_scalar=Fr(1)) noexcept
Multi-scalar multiplication: compute sum_i(scalars[i] * points[i])
element class. Implements ecc group arithmetic using Jacobian coordinates See https://hyperelliptic....
element operator*=(const Fr &exponent) noexcept
BB_INLINE constexpr element set_infinity() const noexcept
element mul_with_endomorphism(const Fr &scalar) const noexcept
static element infinity()
static std::vector< affine_element< Fq, Fr, Params > > batch_mul_with_endomorphism(const std::span< const affine_element< Fq, Fr, Params > > &points, const Fr &scalar) noexcept
Multiply each point by the same scalar.
static constexpr element zero() noexcept
constexpr element dbl() const noexcept
constexpr element normalize() const noexcept
friend constexpr element operator-(const affine_element< Fq, Fr, Params > &left, const element &right) noexcept
constexpr void self_dbl() noexcept
static element random_element(numeric::RNG *engine=nullptr) noexcept
static void batch_normalize(element *elements, size_t num_elements) noexcept
static constexpr element one() noexcept
static void batch_affine_add(const std::span< affine_element< Fq, Fr, Params > > &first_group, const std::span< affine_element< Fq, Fr, Params > > &second_group, const std::span< affine_element< Fq, Fr, Params > > &results) noexcept
Pairwise affine add points in first and second group.
BB_INLINE constexpr bool on_curve() const noexcept
element operator*(const Fr &exponent) const noexcept
constexpr void self_mixed_add_or_sub(const affine_element< Fq, Fr, Params > &other, uint64_t predicate) noexcept
static constexpr Fq curve_b
element() noexcept=default
static void conditional_negate_affine(const affine_element< Fq, Fr, Params > &in, affine_element< Fq, Fr, Params > &out, uint64_t predicate) noexcept
static element random_coordinates_on_curve(numeric::RNG *engine=nullptr) noexcept
static affine_element< Fq, Fr, Params > batch_mul(std::span< const affine_element< Fq, Fr, Params > > points, std::span< const Fr > scalars, size_t max_num_bits=0, bool with_edgecases=true, const Fr &masking_scalar=Fr(1)) noexcept
Multi-scalar multiplication: compute sum_i(scalars[i] * points[i])
element mul_without_endomorphism(const Fr &scalar) const noexcept
constexpr element & operator=(const element &other) noexcept
BB_INLINE constexpr void self_set_infinity() noexcept
BB_INLINE constexpr bool is_point_at_infinity() const noexcept
crypto::Poseidon2Bn254ScalarFieldParams Params
std::ostream & operator<<(std::ostream &os, element< Fq, Fr, Params > const &e)
static constexpr field one()
curve::BN254::BaseField Fq