Main Page   Reference Manual   Compound List   File List  

libecc::point< Polynomial, a, b > Class Template Reference

Point (x,y) on elliptic curve x3 + ax2 + b = y2 + xy. More...

#include <point.h>

List of all members.

Public Types

typedef Polynomial polynomial_type
 The type of the field over which the elliptic curve is defined.

Public Member Functions

 point (void)
 Construct the point at infinity (zero).
 point (std::string x, std::string y)
 Construct a point (x, y) from the strings x and y.
 point (polynomial_type const &x, polynomial_type const &y)
 Construct a point (x, y) from the polynomials x and y.
pointoperator= (point const &p1)
 Copy constructor.
pointoperator+= (point const &p1)
 Add point p1 to this point.
void MULTIPLY_and_assign (point const &pnt, mpz_class const &scalar)
 Multiply the point pnt with scalar and assign the result to this object.
mpz_class order (order_algorithm algorithm=order_default) const
 Calculate the order of this point.
bool operator== (point const &p1) const
 Compare for equality.
bool operator!= (point const &p1) const
 Compare for inequality.
bool check (void) const
 Check if the current point is a solution of the elliptic curve.
polynomial_type const & get_x (void) const
 Retrieve the value of the x coordinate.
polynomial_type const & get_y (void) const
 Retrieve the value of the y coordinate.
bool is_zero (void) const
 Return if this is the point at infinity or not.
void print_on (std::ostream &os) const
 Print the coordinates of this point to an ostream.
void randomize (rds &random_source)
 Generate a random point on the curve.

Detailed Description

template<typename Polynomial, Polynomial const & a, Polynomial const & b>
class libecc::point< Polynomial, a, b >

Point (x,y) on elliptic curve x3 + ax2 + b = y2 + xy.

This class represents a point (x,y) on the elliptic curve x3 + ax2 + b = y2 + xy where x, y, a and b are of the type Polynomial, elements of F2m.

See also:
Theory: points on an Elliptic Curve

Member Typedef Documentation

template<typename Polynomial, Polynomial const & a, Polynomial const & b>
typedef Polynomial libecc::point< Polynomial, a, b >::polynomial_type

The type of the field over which the elliptic curve is defined.


Constructor & Destructor Documentation

template<typename Polynomial, Polynomial const & a, Polynomial const & b>
libecc::point< Polynomial, a, b >::point ( void   )  [inline]

Construct the point at infinity (zero).

template<typename Polynomial, Polynomial const & a, Polynomial const & b>
libecc::point< Polynomial, a, b >::point ( std::string  x,
std::string  y 
) [inline]

Construct a point (x, y) from the strings x and y.

The strings are passed directly to two variables of type polynomial_type.

template<typename Polynomial, Polynomial const & a, Polynomial const & b>
libecc::point< Polynomial, a, b >::point ( polynomial_type const &  x,
polynomial_type const &  y 
) [inline]

Construct a point (x, y) from the polynomials x and y.


Member Function Documentation

template<typename Polynomial , Polynomial const & a, Polynomial const & b>
bool libecc::point< Polynomial, a, b >::check ( void   )  const

Check if the current point is a solution of the elliptic curve.

Returns:
true when the x and y coordinate are a solution of the elliptic curve, or when this is the point at infinity.
template<typename Polynomial, Polynomial const & a, Polynomial const & b>
polynomial_type const& libecc::point< Polynomial, a, b >::get_x ( void   )  const [inline]

Retrieve the value of the x coordinate.

This value is only valid when is_zero returns false.

template<typename Polynomial, Polynomial const & a, Polynomial const & b>
polynomial_type const& libecc::point< Polynomial, a, b >::get_y ( void   )  const [inline]

Retrieve the value of the y coordinate.

This value is only valid when is_zero returns false.

template<typename Polynomial, Polynomial const & a, Polynomial const & b>
bool libecc::point< Polynomial, a, b >::is_zero ( void   )  const [inline]

Return if this is the point at infinity or not.

template<typename Polynomial , Polynomial const & a, Polynomial const & b>
void libecc::point< Polynomial, a, b >::MULTIPLY_and_assign ( point< Polynomial, a, b > const &  pnt,
mpz_class const &  scalar 
)

Multiply the point pnt with scalar and assign the result to this object.

template<typename Polynomial , Polynomial const & a, Polynomial const & b>
bool libecc::point< Polynomial, a, b >::operator!= ( point< Polynomial, a, b > const &  p1  )  const [inline]

Compare for inequality.

Returns:
false if both points are zero, or if they have the same x and y coordinate. Otherwise true is returned.

Referenced by libecc::point< Polynomial, a, b >::operator==().

template<typename Polynomial , Polynomial const & a, Polynomial const & b>
point< Polynomial, a, b > & libecc::point< Polynomial, a, b >::operator+= ( point< Polynomial, a, b > const &  p1  ) 

Add point p1 to this point.

template<typename Polynomial , Polynomial const & a, Polynomial const & b>
point< Polynomial, a, b > & libecc::point< Polynomial, a, b >::operator= ( point< Polynomial, a, b > const &  p1  ) 

Copy constructor.

template<typename Polynomial , Polynomial const & a, Polynomial const & b>
bool libecc::point< Polynomial, a, b >::operator== ( point< Polynomial, a, b > const &  p1  )  const [inline]

Compare for equality.

Returns:
true if both points are zero, or if they have the same x and y coordinate. Otherwise false is returned;

References libecc::point< Polynomial, a, b >::operator!=().

template<typename Polynomial , Polynomial const & a, Polynomial const & b>
mpz_class libecc::point< Polynomial, a, b >::order ( order_algorithm  algorithm = order_default  )  const

Calculate the order of this point.

template<typename Polynomial , Polynomial const & a, Polynomial const & b>
void libecc::point< Polynomial, a, b >::print_on ( std::ostream &  os  )  const

Print the coordinates of this point to an ostream.

template<typename Polynomial , Polynomial const & a, Polynomial const & b>
void libecc::point< Polynomial, a, b >::randomize ( rds &  random_source  ) 

Generate a random point on the curve.

Copyright © 2002-2008 Carlo Wood.  All rights reserved.