Next: Divisor arithmetic, Previous: Genus 2 curve functions, Up: Preface
A divisor (class) is a pair of polynomials [u(x), v(x)] over
GF(q)
with \deg{v}<\deg{u}\le 2 so that they satisfy certain conditions
related to the curve C. Therefore, every divisor (class) has a
curve to associate with. G2HEC use a C++ class divisor
to hold
a divisor.
For cryptographic purposes, G2HEC does not support the existence of divisors
associated with different curves in the same running process. It implements
the associated genus 2 curve as a static data member of the divisor
class. The client program only needs to set the curve once for a divisor, and
it works for all divisors. A curve change for one divisor in a program will
cause all divisors in the same program to switch to the new curve. This is
another important convention of G2HEC.
We list some of the divisor
class’s public member functions as follows.
divisor()
:
default constructor; sets u(x) = 1, v(x) = 0, and associated curve as y^2 = 0. A divisor is not valid by default.
divisor(const poly_tc& polyu, const poly_tc& polyv, const g2hcurve& curve)
:
constructor; set u(x) = polyu
, v(x) = polyv
, and
associated curve to curve
.
divisor(const divisor& div)
:
copy constructor.
void set_upoly(poly_tc& poly)
:
sets u(x) to poly
for the divisor.
void set_vpoly(poly_tc& poly)
:
sets v(x) to poly
for the divisor.
void set_curve(const g2hcurve& curve)
:
sets the associated curve to curve
for divisor. The curve does
not need to be a valid genus 2 curve.
void update()
:
This function checks and updates information related to the divisor. It must
be called by a client program after any set_
routine is called.
Otherwise error make occur when operations on divisor are performed.
const poly_tc& get_upoly()
:
returns u(x) of the divisor.
const poly_tc& get_vpoly()
:
returns v(x) of the divisor.
const g2hcurve& get_curve()
:
returns the associated curve of the divisor.
bool_t is_valid_divisor()
:
returns TRUE
is the representation of the divisor is valid, FALSE
otherwise.
bool_t is_unit()
:
tests if the divisor is the unit divisor [1, 0].
set_unit()
:
sets the divisor to the unit divisor [1, 0].
You can write divisor1 = divisor2
to assign the value of divisor2
to divisor1
. divisor2
can be either valid or invalid.
You can do comparisons like divisor1 == divisor2
or
divisor1 != divisor2
to test if two divisors are the same. Divisors
do not need to be valid for such comparisons.
There is also a non-member function
bool_t on_same_curve(const divisor& a, const divisor& b)
that tests if two divisors a
and b
have the same associated
curve. According to the way G2HEC implements the divisor
class,
this function always returns TRUE
. Therefore this test is redundant.
Next: Divisor arithmetic, Previous: Genus 2 curve functions, Up: Preface