nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine > Struct Template Reference

A struct representing an element from the group G1 of Montgomery curve of affine coordinates representation. Description: https://hyperelliptic.org/EFD/g1p/auto-montgom.html. More...

#include <element_g1_affine.hpp>

+ Collaboration diagram for nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >:

Public Types

using coordinates = coordinates::affine
 
using field_type = typename CurveParams::field_type
 
using form = forms::montgomery
 
using group_type = typename params_type::template group_type< coordinates >
 

Public Member Functions

constexpr curve_element ()
 
constexpr curve_element (const field_value_type &in_X, const field_value_type &in_Y)
 
constexpr curve_element doubled () const
 Affine doubling formulas: 2(x1,y1)=(x3,y3) where. More...
 
constexpr bool is_well_formed () const
 Check that point coordinates satisfy curve equitation: b*y^2 = x^3 + a*x^2 + x. More...
 
constexpr bool is_zero () const
 
constexpr bool operator!= (const curve_element &other) const
 
constexpr curve_element operator+ (const curve_element &other) const
 
constexpr curve_element operator- () const
 Affine negation formulas: -(x1,y1)=(x1,-y1). More...
 
constexpr curve_element operator- (const curve_element &other) const
 
constexpr curve_element operator= (const curve_element &other)
 
constexpr bool operator== (const curve_element &other) const
 
constexpr curve_element to_affine () const
 
constexpr auto to_twisted_edwards () const
 Convert point coordinates into twisted Edwards form according to birational equivalence map: More...
 

Static Public Member Functions

static curve_element one ()
 Get the generator of group G1. More...
 
static curve_element zero ()
 Get the point at infinity. More...
 

Public Attributes

field_value_type X
 
field_value_type Y
 

Detailed Description

template<typename CurveParams>
struct nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >

A struct representing an element from the group G1 of Montgomery curve of affine coordinates representation. Description: https://hyperelliptic.org/EFD/g1p/auto-montgom.html.

Member Typedef Documentation

◆ coordinates

◆ field_type

template<typename CurveParams >
using nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::field_type = typename CurveParams::field_type

◆ form

◆ group_type

template<typename CurveParams >
using nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::group_type = typename params_type::template group_type<coordinates>

Constructor & Destructor Documentation

◆ curve_element() [1/2]

template<typename CurveParams >
constexpr nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::curve_element ( )
inlineconstexpr
Returns
the point at infinity by default

◆ curve_element() [2/2]

template<typename CurveParams >
constexpr nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::curve_element ( const field_value_type &  in_X,
const field_value_type &  in_Y 
)
inlineconstexpr
Returns
the selected point $(X:Y:Z)$ in the projective coordinates

Member Function Documentation

◆ doubled()

template<typename CurveParams >
constexpr curve_element nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::doubled ( ) const
inlineconstexpr

Affine doubling formulas: 2(x1,y1)=(x3,y3) where.

x3 = b*(3*x1^2+2*a*x1+1)^2/(2*b*y1)^2-a-x1-x1 y3 = (2*x1+x1+a)*(3*x1^2+2*a*x1+1)/(2*b*y1)-b*(3*x1^2+2*a*x1+1)^3/(2*b*y1)^3-y1

See https://hyperelliptic.org/EFD/g1p/auto-montgom.html

Returns
doubled element from group G1

◆ is_well_formed()

template<typename CurveParams >
constexpr bool nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::is_well_formed ( ) const
inlineconstexpr

Check that point coordinates satisfy curve equitation: b*y^2 = x^3 + a*x^2 + x.

Returns
true if element from group G1 lies on the elliptic curve

◆ is_zero()

template<typename CurveParams >
constexpr bool nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::is_zero ( ) const
inlineconstexpr
Returns
true if element from group G1 is the point at infinity

◆ one()

template<typename CurveParams >
static curve_element nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::one ( )
inlinestatic

Get the generator of group G1.

◆ operator!=()

template<typename CurveParams >
constexpr bool nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::operator!= ( const curve_element< CurveParams, forms::montgomery, coordinates::affine > &  other) const
inlineconstexpr

◆ operator+()

template<typename CurveParams >
constexpr curve_element nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::operator+ ( const curve_element< CurveParams, forms::montgomery, coordinates::affine > &  other) const
inlineconstexpr

◆ operator-() [1/2]

template<typename CurveParams >
constexpr curve_element nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::operator- ( ) const
inlineconstexpr

Affine negation formulas: -(x1,y1)=(x1,-y1).

Returns
negative element from group G1

◆ operator-() [2/2]

template<typename CurveParams >
constexpr curve_element nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::operator- ( const curve_element< CurveParams, forms::montgomery, coordinates::affine > &  other) const
inlineconstexpr

◆ operator=()

template<typename CurveParams >
constexpr curve_element nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::operator= ( const curve_element< CurveParams, forms::montgomery, coordinates::affine > &  other)
inlineconstexpr

◆ operator==()

template<typename CurveParams >
constexpr bool nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::operator== ( const curve_element< CurveParams, forms::montgomery, coordinates::affine > &  other) const
inlineconstexpr

◆ to_affine()

template<typename CurveParams >
constexpr curve_element nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::to_affine ( ) const
inlineconstexpr
Returns
return the corresponding element from affine coordinates to affine coordinates. Just for compatibility.

◆ to_twisted_edwards()

template<typename CurveParams >
constexpr auto nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::to_twisted_edwards ( ) const
inlineconstexpr

Convert point coordinates into twisted Edwards form according to birational equivalence map:

  • Montgomery(A', B') -–> Twisted Edwards(a, d) (u', v') --> (x, y) where A' = 2 * (a + d) / (a - d) B' = 4 / (a - d)

    x = u' / v' y = (u' - 1) / (u' + 1)

  • Montgomery(A', B') -–> Montgomery(A, B) (u', v') --> (u, v) where A == A' B = s^2 * B' (mod p) <=> s = (B / B').sqrt() (mod p)

    u = u' s * v = v'

  • Montgomery(A, B) -–> Twisted Edwards(a, d) (u, v) --> (x, y)

    x = u' / v' = u / (s * v) y = (u - 1) / (u + 1)

See https://math.stackexchange.com/questions/1391732/birational-equvalence-of-twisted-edwards-and-montgomery-curves See https://math.stackexchange.com/questions/1392277/point-conversion-between-twisted-edwards-and-montgomery-curves

Returns
point in affine coordinates of twisted Edwards form

◆ zero()

template<typename CurveParams >
static curve_element nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::zero ( )
inlinestatic

Get the point at infinity.

Member Data Documentation

◆ X

template<typename CurveParams >
field_value_type nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::X

◆ Y

template<typename CurveParams >
field_value_type nil::crypto3::algebra::curves::detail::curve_element< CurveParams, forms::montgomery, coordinates::affine >::Y

The documentation for this struct was generated from the following file: