33template <
class Fq,
class Fr,
class Params>
class alignas(32)
element {
110 std::span<const
Fr> scalars,
111 size_t max_num_bits = 0,
112 bool with_edgecases = true,
128 template <
typename =
typename std::enable_if<Params::can_hash_to_curve>>
133 os <<
"{ " <<
a.x <<
", " <<
a.y <<
", " <<
a.z <<
" }";
140 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
static constexpr Fq curve_b
element() noexcept=default
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)
AffineElement const size_t Fq *scratch_space noexcept
static constexpr field one()
curve::BN254::BaseField Fq