fq2.h File Reference

Definition of Fq2 math. More...

#include <stdint.h>

Functions

void Fq2Cp (Fq2Elem *result, Fq2Elem const *in)
 Copy an element's value. More...
 
void Fq2Set (Fq2Elem *result, uint32_t in)
 Set an element's value. More...
 
void Fq2Clear (Fq2Elem *result)
 Clear an element's value. More...
 
void Fq2Add (Fq2Elem *result, Fq2Elem const *left, Fq2Elem const *right)
 Add two elements of Fq2. More...
 
void Fq2Exp (Fq2Elem *result, Fq2Elem const *base, VeryLargeInt const *exp)
 Exponentiate an element of Fq2 by a large integer. More...
 
void Fq2Sub (Fq2Elem *result, Fq2Elem const *left, Fq2Elem const *right)
 Subtract two elements of Fq2. More...
 
void Fq2Mul (Fq2Elem *result, Fq2Elem const *left, Fq2Elem const *right)
 Multiply two elements of Fq2. More...
 
void Fq2Inv (Fq2Elem *result, Fq2Elem const *in)
 Invert an element of Fq2. More...
 
void Fq2Neg (Fq2Elem *result, Fq2Elem const *in)
 Negate an element of Fq2. More...
 
void Fq2Conj (Fq2Elem *result, Fq2Elem const *in)
 Calculate the conjugate of an element of Fq2. More...
 
void Fq2Square (Fq2Elem *result, Fq2Elem const *in)
 Square an element of Fq2. More...
 
void Fq2MulScalar (Fq2Elem *result, Fq2Elem const *left, FqElem const *right)
 Multiply an element of Fq2 by and element of Fq. More...
 
void Fq2CondSet (Fq2Elem *result, Fq2Elem const *true_val, Fq2Elem const *false_val, int truth_val)
 Conditionally Set an element's value to one of two values. More...
 
int Fq2Eq (Fq2Elem const *left, Fq2Elem const *right)
 Test if two elements in Fq2 are equal. More...
 
void Fq2MulXi (Fq2Elem *result, Fq2Elem const *in)
 Multiply an element of Fq2 by xi. More...
 
int Fq2IsZero (Fq2Elem const *value)
 Test if an element is zero. More...
 

Detailed Description

Definition of Fq2 math.

Function Documentation

◆ Fq2Add()

void Fq2Add ( Fq2Elem result,
Fq2Elem const *  left,
Fq2Elem const *  right 
)

Add two elements of Fq2.

Parameters
[out]resultof adding left and right.
[in]leftThe first operand to be added.
[in]rightThe second operand to be added.

◆ Fq2Clear()

void Fq2Clear ( Fq2Elem result)

Clear an element's value.

Parameters
[out]resultelement to clear.

◆ Fq2CondSet()

void Fq2CondSet ( Fq2Elem result,
Fq2Elem const *  true_val,
Fq2Elem const *  false_val,
int  truth_val 
)

Conditionally Set an element's value to one of two values.

Parameters
[out]resulttarget.
[in]true_valvalue to set if condition is true.
[in]false_valvalue to set if condition is false.
[in]truth_valvalue of condition.

◆ Fq2Conj()

void Fq2Conj ( Fq2Elem result,
Fq2Elem const *  in 
)

Calculate the conjugate of an element of Fq2.

Parameters
[out]resultthe conjugate of the element.
[in]inthe element.

◆ Fq2Cp()

void Fq2Cp ( Fq2Elem result,
Fq2Elem const *  in 
)

Copy an element's value.

Parameters
[out]resultcopy target.
[in]incopy source.

◆ Fq2Eq()

int Fq2Eq ( Fq2Elem const *  left,
Fq2Elem const *  right 
)

Test if two elements in Fq2 are equal.

Parameters
[in]leftThe first operand to be tested.
[in]rightThe second operand to be tested.
Returns
A value different from zero (i.e., true) if indeed the values are equal. Zero (i.e., false) otherwise.

◆ Fq2Exp()

void Fq2Exp ( Fq2Elem result,
Fq2Elem const *  base,
VeryLargeInt const *  exp 
)

Exponentiate an element of Fq2 by a large integer.

Parameters
[out]resulttarget.
[in]basethe base.
[in]expthe exponent.

◆ Fq2Inv()

void Fq2Inv ( Fq2Elem result,
Fq2Elem const *  in 
)

Invert an element of Fq2.

Parameters
[out]resultthe inverse of the element.
[in]inthe element to invert.

◆ Fq2IsZero()

int Fq2IsZero ( Fq2Elem const *  value)

Test if an element is zero.

Parameters
[in]valuethe element to test.
Returns
A value different from zero (i.e., true) if indeed the value is zero. Zero (i.e., false) otherwise.

◆ Fq2Mul()

void Fq2Mul ( Fq2Elem result,
Fq2Elem const *  left,
Fq2Elem const *  right 
)

Multiply two elements of Fq2.

Parameters
[out]resultof multiplying left and right.
[in]leftThe first operand to be multiplied.
[in]rightThe second operand to be multiplied.

◆ Fq2MulScalar()

void Fq2MulScalar ( Fq2Elem result,
Fq2Elem const *  left,
FqElem const *  right 
)

Multiply an element of Fq2 by and element of Fq.

Parameters
[out]resultof multiplying left and right.
[in]leftThe first operand to be multiplied.
[in]rightThe second operand to be multiplied.

◆ Fq2MulXi()

void Fq2MulXi ( Fq2Elem result,
Fq2Elem const *  in 
)

Multiply an element of Fq2 by xi.

This function was formerly called as Fq2Const.

Parameters
[out]resultof multiplying in by xi.
[in]inThe first operand to be multiplied.

◆ Fq2Neg()

void Fq2Neg ( Fq2Elem result,
Fq2Elem const *  in 
)

Negate an element of Fq2.

Parameters
[out]resultthe negative of the element.
[in]inthe element to negate.

◆ Fq2Set()

void Fq2Set ( Fq2Elem result,
uint32_t  in 
)

Set an element's value.

Parameters
[out]resulttarget.
[in]invalue to set.

◆ Fq2Square()

void Fq2Square ( Fq2Elem result,
Fq2Elem const *  in 
)

Square an element of Fq2.

Parameters
[out]resultthe square of the element.
[in]inthe element to square.

◆ Fq2Sub()

void Fq2Sub ( Fq2Elem result,
Fq2Elem const *  left,
Fq2Elem const *  right 
)

Subtract two elements of Fq2.

Parameters
[out]resultof subtracting left from right.
[in]leftThe operand to be subtracted from.
[in]rightThe operand to subtract.