26 #ifndef CRYPTO3_ALGEBRA_CURVES_SHORT_WEIERSTRASS_G1_ELEMENT_JACOBIAN_WITH_A4_0_ADD_2007_BL_HPP
27 #define CRYPTO3_ALGEBRA_CURVES_SHORT_WEIERSTRASS_G1_ELEMENT_JACOBIAN_WITH_A4_0_ADD_2007_BL_HPP
43 template<
typename ElementType>
44 constexpr
static inline ElementType
process(
const ElementType &first,
45 const ElementType &second) {
47 using field_value_type =
typename ElementType::field_type::value_type;
49 field_value_type Z1Z1 = (first.Z).squared();
50 field_value_type Z2Z2 = (second.Z).squared();
51 field_value_type U1 = (first.X) * Z2Z2;
52 field_value_type U2 = (second.X) * Z1Z1;
53 field_value_type S1 = (first.Y) * (second.Z) * Z2Z2;
54 field_value_type S2 = (second.Y) * (first.Z) * Z1Z1;
55 field_value_type H = U2 - U1;
56 field_value_type S2_minus_S1 = S2 - S1;
57 field_value_type I = (H + H).squared();
58 field_value_type J = H * I;
59 field_value_type r = S2_minus_S1 + S2_minus_S1;
60 field_value_type V = U1 * I;
61 field_value_type X3 = r.squared() - J - (V + V);
62 field_value_type S1_J = S1 * J;
63 field_value_type Y3 = r * (V - X3) - (S1_J + S1_J);
65 ((first.Z + second.Z).squared() - Z1Z1 - Z2Z2) * H;
67 return ElementType(X3, Y3, Z3);
A struct representing element addition from the group G1 of short Weierstrass curve for jacobian_with...
Definition: short_weierstrass/jacobian_with_a4_0/add_2007_bl.hpp:41
constexpr static ElementType process(const ElementType &first, const ElementType &second)
Definition: short_weierstrass/jacobian_with_a4_0/add_2007_bl.hpp:44