BitPunch McEliece  v0.0.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gf2x.h File Reference
#include <stdint.h>
#include <bitpunch/config.h>
#include "gf2.h"
#include "gf2xtypes.h"
#include "mathctx.h"

Go to the source code of this file.

Macros

#define BPU_gf2xInvElement(gf2_16x_e, math_ctx_p)   ((gf2_16x_e) == 1 ? 1 : (math_ctx_p)->exp_table[((math_ctx_p)->ord - (math_ctx_p)->log_table[gf2_16x_e])])
 Get inverse element of galois field. More...
 
#define BPU_gf2xPolyLeadCoef(poly_gf2_16x_p)   ((poly_gf2_16x_p)->deg > -1 ? (poly_gf2_16x_p)->coef[(poly_gf2_16x_p)->deg] : 0)
 
#define BPU_gf2xMulModT(a, b, math_ctx)   (((a) == 0 || (b) == 0) ? 0 : (math_ctx)->exp_table[((math_ctx)->log_table[(a)] + (math_ctx)->log_table[(b)]) % (math_ctx)->ord])
 Multiplication over Galois field, modulus mod. More...
 

Functions

void BPU_printGf2xMat (const BPU_T_GF2_16x_Matrix *in)
 
void BPU_printGf2xPoly (const BPU_T_GF2_16x_Poly *p, const BPU_T_Math_Ctx *math_ctx)
 BPU_printGf2xPoly print GF2x polynomial. More...
 
void BPU_printGf2xVec (const BPU_T_GF2_16x_Vector *v)
 BPU_printGf2xVec print GF2x vector. More...
 
BPU_T_GF2_16x BPU_gf2xMulMod (BPU_T_GF2_16x a, BPU_T_GF2_16x b, BPU_T_GF2_16x mod)
 Multiplication over Galois field, modulus mod. More...
 
BPU_T_GF2_16x BPU_gf2xPowerModT (BPU_T_GF2_16x a, int e, const BPU_T_Math_Ctx *math_ctx)
 E-th power of a. It uses precomputed log and exp tables. More...
 
int BPU_gf2xMatMul (BPU_T_GF2_16x_Matrix *x, const BPU_T_GF2_16x_Matrix *a, const BPU_T_GF2_16x_Matrix *b, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xVecMulMat (BPU_T_GF2_16x_Vector *out, const BPU_T_GF2_16x_Vector *x, const BPU_T_GF2_16x_Matrix *mat, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xPolyAdd (BPU_T_GF2_16x_Poly *out, const BPU_T_GF2_16x_Poly *a, const BPU_T_GF2_16x_Poly *b)
 
void BPU_gf2xPolyDiv (BPU_T_GF2_16x_Poly *q, BPU_T_GF2_16x_Poly *r, const BPU_T_GF2_16x_Poly *a, const BPU_T_GF2_16x_Poly *b, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xPolyMul (BPU_T_GF2_16x_Poly *out, const BPU_T_GF2_16x_Poly *a, const BPU_T_GF2_16x_Poly *b, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xPolyShr (BPU_T_GF2_16x_Poly *a, int n)
 Shift polynomial right, it is like a div x^n. More...
 
void BPU_gf2xPolyShl (BPU_T_GF2_16x_Poly *a, int n)
 Shift polynomial left, it is like a mul 1/x^n. More...
 
void BPU_gf2xPolyPower (BPU_T_GF2_16x_Poly *a, int e, const BPU_T_Math_Ctx *math_ctx)
 Calculate power of polynomial. More...
 
void BPU_gf2xPolyMulEl (BPU_T_GF2_16x_Poly *a, BPU_T_GF2_16x el, const BPU_T_Math_Ctx *math_ctx)
 Multiplication polynomial over GF2_16x and element from GF2_16x. More...
 
void BPU_gf2xPolyMod (BPU_T_GF2_16x_Poly *out, const BPU_T_GF2_16x_Poly *a, const BPU_T_GF2_16x_Poly *mod, const BPU_T_Math_Ctx *math_ctx)
 Calculate reminder of a. Example a mod b = reminder. More...
 
void BPU_gf2xMatRoot (BPU_T_GF2_16x_Matrix *out, const BPU_T_GF2_16x_Poly *mod, const BPU_T_Math_Ctx *math_ctx)
 
BPU_T_GF2_16x BPU_gf2xRoot (BPU_T_GF2_16x element, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xPolyRoot (BPU_T_GF2_16x_Poly *out, const BPU_T_GF2_16x_Poly *poly, const BPU_T_GF2_16x_Poly *mod, const BPU_T_Math_Ctx *math_ctx)
 BPU_gf2xPolyRoot calculate root of given polynomial over GF2x. More...
 
void BPU_gf2xPolyCopy (BPU_T_GF2_16x_Poly *dest, const BPU_T_GF2_16x_Poly *src)
 Copy Polynomial. More...
 
int BPU_gf2xGetDeg (BPU_T_GF2_32x pol)
 Get degree of polynomial over GF2. More...
 
int BPU_gf2xPolyGetDeg (BPU_T_GF2_16x_Poly *poly)
 Get degree of polynomial over GF2x. More...
 
int BPU_gf2xMatPermute (BPU_T_GF2_16x_Matrix *out, const BPU_T_GF2_16x_Matrix *m, const BPU_T_Perm_Vector *permutation)
 
int BPU_gf2xMatConvertToGf2Mat (BPU_T_GF2_Matrix *out, const BPU_T_GF2_16x_Matrix *m, int deg)
 
BPU_T_GF2_16x BPU_gf2xPolyEval (const BPU_T_GF2_16x_Poly *poly, const BPU_T_GF2_16x x, const BPU_T_Math_Ctx *math_ctx)
 Evaluate polynomial over GF2^m with x. More...
 
int BPU_gf2xPolyExtEuclid (BPU_T_GF2_16x_Poly *d, BPU_T_GF2_16x_Poly *s, BPU_T_GF2_16x_Poly *t, const BPU_T_GF2_16x_Poly *a, const BPU_T_GF2_16x_Poly *b, int end_deg, const BPU_T_Math_Ctx *math_ctx)
 Extended Euclidean to find greatest common divisor and Bézout coefficients s, t, where gcd(a, b) = d = a*s + b*t. More...
 
int BPU_gf2xPolyCmp (const BPU_T_GF2_16x_Poly *p1, const BPU_T_GF2_16x_Poly *p2)
 
int BPU_gf2xPolyIrredTest (const BPU_T_GF2_16x_Poly *p, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xPolyInv (BPU_T_GF2_16x_Poly *out, const BPU_T_GF2_16x_Poly *a, const BPU_T_GF2_16x_Poly *mod, const BPU_T_Math_Ctx *math_ctx)
 Get inverse polynomial over GF2_16x. More...
 
BPU_T_GF2_16x BPU_gf2xPolyMakeMonic (BPU_T_GF2_16x_Poly *a, const BPU_T_Math_Ctx *math_ctx)
 Make from polynomial monic polynomial. More...
 
void BPU_gf2xMatInsertPoly (BPU_T_GF2_16x_Matrix *mat, const BPU_T_GF2_16x_Poly *poly, int i)
 
void BPU_gf2xPolyToVec (BPU_T_GF2_16x_Vector *vec, const BPU_T_GF2_16x_Poly *poly, int len)
 
void BPU_gf2xMatGEM (BPU_T_GF2_16x_Matrix *mat, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xSwap (BPU_T_GF2_16x *a, BPU_T_GF2_16x *b)
 
void BPU_gf2xMatSwapRows (BPU_T_GF2_16x_Matrix *mat, int i, int j)
 
void BPU_gf2xMatMulElRow (BPU_T_GF2_16x_Matrix *mat, const BPU_T_GF2_16x element, int i, const BPU_T_Math_Ctx *math_ctx)
 
int BPU_gf2xMatFindPivot (const BPU_T_GF2_16x_Matrix *mat, int index)
 
BPU_T_GF2_16x BPU_gf2xGetPseudoInv (const BPU_T_GF2_16x a, const BPU_T_GF2_16x res, const BPU_T_Math_Ctx *math_ctx)
 Get GF2_16x element which is a * return = res. More...
 
void BPU_gf2xMatXorRows (BPU_T_GF2_16x_Matrix *mat, int index, int j, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xVecMulEl (BPU_T_GF2_16x_Vector *vec, BPU_T_GF2_16x element, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xVecToPoly (BPU_T_GF2_16x_Poly *poly, const BPU_T_GF2_16x_Vector *vec)
 
void BPU_gf2xMatClearCol (BPU_T_GF2_16x_Matrix *mat, int index, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xPolyGenRandom (BPU_T_GF2_16x_Poly *p, int t, const BPU_T_Math_Ctx *math_ctx)
 
void BPU_gf2xPolyGenGoppa (BPU_T_GF2_16x_Poly *p, int t, const BPU_T_Math_Ctx *math_ctx)
 

Macro Definition Documentation

#define BPU_gf2xInvElement (   gf2_16x_e,
  math_ctx_p 
)    ((gf2_16x_e) == 1 ? 1 : (math_ctx_p)->exp_table[((math_ctx_p)->ord - (math_ctx_p)->log_table[gf2_16x_e])])

Get inverse element of galois field.

Get inverse element of galois field.

Parameters
gf2_16x_efind inverse element to this element
math_ctx_ppointer to BPU_T_Math_Ctx structure
Returns
inverse element

Definition at line 64 of file gf2x.h.

#define BPU_gf2xMulModT (   a,
  b,
  math_ctx 
)    (((a) == 0 || (b) == 0) ? 0 : (math_ctx)->exp_table[((math_ctx)->log_table[(a)] + (math_ctx)->log_table[(b)]) % (math_ctx)->ord])

Multiplication over Galois field, modulus mod.

Multiplication over Galois field, modulus mod. It precalculated tables BPU_initLogExpTable

Parameters
math_ctxpointer to Aritmetic_Data structure, used by calculations
afirst operant, GF2x element
bsecond operant, GF2x element
Returns
result

Definition at line 94 of file gf2x.h.

#define BPU_gf2xPolyLeadCoef (   poly_gf2_16x_p)    ((poly_gf2_16x_p)->deg > -1 ? (poly_gf2_16x_p)->coef[(poly_gf2_16x_p)->deg] : 0)

Get leading coefitient of Polynomal over GF2x.

Parameters
poly_gf2_16x_ppointer to BPU_T_Poly_GF2_16x structure
Returns
leading coef (element from GF2^16) or 0* Get leading coefitient of Polynomal over GF2x.

Definition at line 72 of file gf2x.h.

Function Documentation

int BPU_gf2xGetDeg ( BPU_T_GF2_32x  pol)

Get degree of polynomial over GF2.

Get degree of polynomial over GF2.

Parameters
polinput polynomial
Returns
degree of pol or -1 if it is pol = 0

Definition at line 477 of file gf2x.c.

BPU_T_GF2_16x BPU_gf2xGetPseudoInv ( const BPU_T_GF2_16x  a,
const BPU_T_GF2_16x  res,
const BPU_T_Math_Ctx math_ctx 
)

Get GF2_16x element which is a * return = res.

Get GF2_16x element which is a * return = res.

Parameters
ainput element
resinput element
Returns
element a * return = res

Definition at line 803 of file gf2x.c.

void BPU_gf2xMatClearCol ( BPU_T_GF2_16x_Matrix mat,
int  index,
const BPU_T_Math_Ctx math_ctx 
)

Definition at line 895 of file gf2x.c.

int BPU_gf2xMatConvertToGf2Mat ( BPU_T_GF2_Matrix out,
const BPU_T_GF2_16x_Matrix m,
int  deg 
)

Converts matrix GF2m to matrix GF2.

Parameters
mmatrix GF2m
degdegree of elements from GF2m
outoutput matrix GF2
Returns
on succes 0, else error

Definition at line 519 of file gf2x.c.

int BPU_gf2xMatFindPivot ( const BPU_T_GF2_16x_Matrix mat,
int  index 
)

find row where pivot is at index index

Parameters
mat[description]
index[description]
Returns
[description]

Definition at line 859 of file gf2x.c.

void BPU_gf2xMatGEM ( BPU_T_GF2_16x_Matrix mat,
const BPU_T_Math_Ctx math_ctx 
)

GEM applied on matrix with coefitients from GF2^m

Parameters
mat[description]
math_ctx[description]

Definition at line 905 of file gf2x.c.

void BPU_gf2xMatInsertPoly ( BPU_T_GF2_16x_Matrix mat,
const BPU_T_GF2_16x_Poly poly,
int  i 
)

Insert coefitients from poly into matrix mat to i-th row

Parameters
poly[description]
mat[description]
i[description]

Definition at line 807 of file gf2x.c.

int BPU_gf2xMatMul ( BPU_T_GF2_16x_Matrix x,
const BPU_T_GF2_16x_Matrix a,
const BPU_T_GF2_16x_Matrix b,
const BPU_T_Math_Ctx math_ctx 
)

Matrix multiplication over finite field.. x = a*b

Parameters
[out]xmatrix GF2^m, new matrix
[in]amatrix GF2^m
[in]bmatrix GF2^m
Returns
on succes 0, on size error -1, on allocation error -2

Definition at line 129 of file gf2x.c.

void BPU_gf2xMatMulElRow ( BPU_T_GF2_16x_Matrix mat,
const BPU_T_GF2_16x  element,
int  i,
const BPU_T_Math_Ctx math_ctx 
)

Multiply whole row of matrix mat by element from finite field

Parameters
mat[description]
element[description]
i[description]
math_ctx[description]

Definition at line 852 of file gf2x.c.

int BPU_gf2xMatPermute ( BPU_T_GF2_16x_Matrix out,
const BPU_T_GF2_16x_Matrix m,
const BPU_T_Perm_Vector permutation 
)

Permute matrix GF2^m with permutation.

Parameters
mmatrix GF2^m
permutationpermutation vector
Returns
on succes 0, on size error -1, on allocation error -2

Definition at line 501 of file gf2x.c.

void BPU_gf2xMatRoot ( BPU_T_GF2_16x_Matrix out,
const BPU_T_GF2_16x_Poly mod,
const BPU_T_Math_Ctx math_ctx 
)

Compute root of polynomial poly modulo polynomial mod and save result to polynomial out. Matrix out is allocated inside of the function.

Parameters
poly[description]
mod[description]
out[description]
math_ctx[description]

Definition at line 382 of file gf2x.c.

void BPU_gf2xMatSwapRows ( BPU_T_GF2_16x_Matrix mat,
int  i,
int  j 
)

in matrix mat swap rows i and j

Parameters
mat[description]
i[description]
j[description]

Definition at line 845 of file gf2x.c.

void BPU_gf2xMatXorRows ( BPU_T_GF2_16x_Matrix mat,
int  index,
int  j,
const BPU_T_Math_Ctx math_ctx 
)

If at mat->elements[j][index] is not zero, then mat->row[j] = mat->row[j] ^ (element * (mat->row[index]))

Parameters
mat[description]
index[description]
j[description]

Definition at line 876 of file gf2x.c.

BPU_T_GF2_16x BPU_gf2xMulMod ( BPU_T_GF2_16x  a,
BPU_T_GF2_16x  b,
BPU_T_GF2_16x  mod 
)

Multiplication over Galois field, modulus mod.

Multiplication over Galois field, modulus mod.

Parameters
afirst operant
bsecond operant
modmodulus, ireducible polynomial
Returns
a*b mod mod

Definition at line 78 of file gf2x.c.

void BPU_gf2xPolyAdd ( BPU_T_GF2_16x_Poly out,
const BPU_T_GF2_16x_Poly a,
const BPU_T_GF2_16x_Poly b 
)

Plus operation on polynomials (out = a + b). All argumets must be allocated before using BPU_mallocPoly().

Parameters
out[description]
a[description]
b[description]

Definition at line 161 of file gf2x.c.

int BPU_gf2xPolyCmp ( const BPU_T_GF2_16x_Poly p1,
const BPU_T_GF2_16x_Poly p2 
)

Function compares two polynomials

Parameters
p1[description]
p2[description]
Returns
0 if are same, -1 when deg differs, >0 index of first diff result is index + 1

Definition at line 645 of file gf2x.c.

void BPU_gf2xPolyCopy ( BPU_T_GF2_16x_Poly dest,
const BPU_T_GF2_16x_Poly src 
)

Copy Polynomial.

Copy Polynomial.

Parameters
dest[out]pointer to GF2_16x polynomial
src[in]pointer to GF2_16x polynomial

Definition at line 757 of file gf2x.c.

void BPU_gf2xPolyDiv ( BPU_T_GF2_16x_Poly q,
BPU_T_GF2_16x_Poly r,
const BPU_T_GF2_16x_Poly a,
const BPU_T_GF2_16x_Poly b,
const BPU_T_Math_Ctx math_ctx 
)

Divide two polynomials. All argumets must be allocated before using BPU_mallocPoly().

Parameters
q[out] output quocient
r[out] output reminder
a[in] input polynomial
b[in] input polynomial

Definition at line 184 of file gf2x.c.

BPU_T_GF2_16x BPU_gf2xPolyEval ( const BPU_T_GF2_16x_Poly poly,
const BPU_T_GF2_16x  x,
const BPU_T_Math_Ctx math_ctx 
)

Evaluate polynomial over GF2^m with x.

Evaluate polynomial over GF2^m with x.

Parameters
math_ctxpointer to Aritmetic_Data structure, used by calculations
polypolynomial to evaluate over GF2x
xvalue to evaluate, GF2x element
Returns
evaluated polynomial, GF2x element

Definition at line 634 of file gf2x.c.

int BPU_gf2xPolyExtEuclid ( BPU_T_GF2_16x_Poly d,
BPU_T_GF2_16x_Poly s,
BPU_T_GF2_16x_Poly t,
const BPU_T_GF2_16x_Poly a,
const BPU_T_GF2_16x_Poly b,
int  end_deg,
const BPU_T_Math_Ctx math_ctx 
)

Extended Euclidean to find greatest common divisor and Bézout coefficients s, t, where gcd(a, b) = d = a*s + b*t.

Extended euclidian to find greatest common divisor and Bézout coefficients s, t, where gcd(a, b) = d = a*s + b*t. You can specify degegree, when will it ends, deg(d) > end_deg. Polynomials d, s, t will be allocated inside function. After work should be freed using BPU_freePoly().

Parameters
d[out]greatest common divisor
s[out]Bézout coefficients
t[out]Bézout coefficients
a[in]input polynomial
b[in]input polynomial
end_deg[in]it will ends, when deg(devider) <= end_deg
math_ctx[in]arithmetic data structure, initialized galois field
Returns
0

Definition at line 545 of file gf2x.c.

void BPU_gf2xPolyGenGoppa ( BPU_T_GF2_16x_Poly p,
int  t,
const BPU_T_Math_Ctx math_ctx 
)

Generate monic irreducible polynopmial of degree t.

Parameters
p[description]
t[description]
math_ctx[description]

Definition at line 934 of file gf2x.c.

void BPU_gf2xPolyGenRandom ( BPU_T_GF2_16x_Poly p,
int  t,
const BPU_T_Math_Ctx math_ctx 
)

Generate monic polynomial of degree t and with non-zero coefficient a_0

Parameters
p[description]
t[description]
math_ctx[description]

Definition at line 923 of file gf2x.c.

int BPU_gf2xPolyGetDeg ( BPU_T_GF2_16x_Poly poly)

Get degree of polynomial over GF2x.

Get degree of polynomial over GF2x.

Parameters
polinput polynomial
Returns
degree of pol or -1 if it is pol = 0

Definition at line 489 of file gf2x.c.

void BPU_gf2xPolyInv ( BPU_T_GF2_16x_Poly out,
const BPU_T_GF2_16x_Poly a,
const BPU_T_GF2_16x_Poly mod,
const BPU_T_Math_Ctx math_ctx 
)

Get inverse polynomial over GF2_16x.

Get inverse polynomial over GF2_16x. It is using Extended Euclidean alg.

Parameters
a[in]input polynomial
mod[in]modulus polynomial
out[out]output polynomial
math_ctx[in]arithmetic data structure

Definition at line 770 of file gf2x.c.

int BPU_gf2xPolyIrredTest ( const BPU_T_GF2_16x_Poly p,
const BPU_T_Math_Ctx math_ctx 
)

Function tests if polynomial is irreducible or not.

Parameters
p[description]
math_ctx[description]
Returns
[description]

Definition at line 658 of file gf2x.c.

BPU_T_GF2_16x BPU_gf2xPolyMakeMonic ( BPU_T_GF2_16x_Poly a,
const BPU_T_Math_Ctx math_ctx 
)

Make from polynomial monic polynomial.

Make from polynomial monic polynomial. It means that it will be multiplicated with (leading coef)^-1. It will change source polynomial.

Parameters
apolynomial to be monic
math_ctxarithmetic data structure
Returns
inverse leading coefitient or 0

Definition at line 790 of file gf2x.c.

void BPU_gf2xPolyMod ( BPU_T_GF2_16x_Poly out,
const BPU_T_GF2_16x_Poly a,
const BPU_T_GF2_16x_Poly mod,
const BPU_T_Math_Ctx math_ctx 
)

Calculate reminder of a. Example a mod b = reminder.

Calculate reminder of a. Example a mod b = reminder. ALl arguments must be allocated before use.

Parameters
a[in]input polynomial over GF2_16x
mod[in]input polynomial modul over GF2_16x
out[out]output polynomial reminder over GF2_16x, must be allocated first
math_ctx[in]aritmetics data structure

Definition at line 340 of file gf2x.c.

void BPU_gf2xPolyMul ( BPU_T_GF2_16x_Poly out,
const BPU_T_GF2_16x_Poly a,
const BPU_T_GF2_16x_Poly b,
const BPU_T_Math_Ctx math_ctx 
)

Multiplicate two polynomials. All argumets must be allocated before using BPU_mallocPoly().

Parameters
a[in] input polynomial
b[in] input polynomial
out[out] output polynomial
math_ctxlog and exp table needed for multiplication of elements in GF2^m

Definition at line 235 of file gf2x.c.

void BPU_gf2xPolyMulEl ( BPU_T_GF2_16x_Poly a,
BPU_T_GF2_16x  el,
const BPU_T_Math_Ctx math_ctx 
)

Multiplication polynomial over GF2_16x and element from GF2_16x.

Multiplication polynomial over GF2_16x and element from GF2_16x. It is like multiplication of polynomials

Parameters
apolynomial to be multiplicated
elmultiplicator
math_ctxarithmetic data structure

Definition at line 331 of file gf2x.c.

void BPU_gf2xPolyPower ( BPU_T_GF2_16x_Poly a,
int  e,
const BPU_T_Math_Ctx math_ctx 
)

Calculate power of polynomial.

Calculate power of polynomial.

Parameters
a[inout]polynomial to be 'powered'
eexponent
math_ctxaitmetic data structure.

Definition at line 296 of file gf2x.c.

void BPU_gf2xPolyRoot ( BPU_T_GF2_16x_Poly out,
const BPU_T_GF2_16x_Poly poly,
const BPU_T_GF2_16x_Poly mod,
const BPU_T_Math_Ctx math_ctx 
)

BPU_gf2xPolyRoot calculate root of given polynomial over GF2x.

Parameters
out
poly
mod
math_ctx

Definition at line 450 of file gf2x.c.

void BPU_gf2xPolyShl ( BPU_T_GF2_16x_Poly a,
int  n 
)

Shift polynomial left, it is like a mul 1/x^n.

Shift polynomial left, it is like a mul 1/x^n.

Parameters
a[inout]input/output polynomial
n[in]shift

Definition at line 274 of file gf2x.c.

void BPU_gf2xPolyShr ( BPU_T_GF2_16x_Poly a,
int  n 
)

Shift polynomial right, it is like a div x^n.

Shift polynomial right, it is like a div x^n.

Parameters
a[inout]input/output polynomial
n[in]shift

Definition at line 255 of file gf2x.c.

void BPU_gf2xPolyToVec ( BPU_T_GF2_16x_Vector vec,
const BPU_T_GF2_16x_Poly poly,
int  len 
)

save poly coefitients to vector, it allocates vec inside function. After use use BPU_freeVectorGF2_16x

Parameters
poly[description]
vec[description]

Definition at line 814 of file gf2x.c.

BPU_T_GF2_16x BPU_gf2xPowerModT ( BPU_T_GF2_16x  a,
int  e,
const BPU_T_Math_Ctx math_ctx 
)

E-th power of a. It uses precomputed log and exp tables.

E-th power of a. It uses precomputed log and exp tables.

Parameters
math_ctxpointer to Aritmetic_Data structure, used by calculations
aGF2x element
eexponent
Returns
result

Definition at line 110 of file gf2x.c.

BPU_T_GF2_16x BPU_gf2xRoot ( BPU_T_GF2_16x  element,
const BPU_T_Math_Ctx math_ctx 
)

Function returns sqrt(element)

Parameters
element[description]
math_ctx[description]
Returns
[description]

Definition at line 434 of file gf2x.c.

void BPU_gf2xSwap ( BPU_T_GF2_16x a,
BPU_T_GF2_16x b 
)

Swap

Parameters
a[description]
b[description]

Definition at line 838 of file gf2x.c.

void BPU_gf2xVecMulEl ( BPU_T_GF2_16x_Vector vec,
BPU_T_GF2_16x  element,
const BPU_T_Math_Ctx math_ctx 
)

vec = element*vec

Parameters
vec[description]
element[description]
math_ctx[description]

Definition at line 869 of file gf2x.c.

void BPU_gf2xVecMulMat ( BPU_T_GF2_16x_Vector out,
const BPU_T_GF2_16x_Vector x,
const BPU_T_GF2_16x_Matrix mat,
const BPU_T_Math_Ctx math_ctx 
)

out = x * M over finite field

Parameters
x[description]
mat[description]
out[description]

Definition at line 421 of file gf2x.c.

void BPU_gf2xVecToPoly ( BPU_T_GF2_16x_Poly poly,
const BPU_T_GF2_16x_Vector vec 
)

Definition at line 829 of file gf2x.c.

void BPU_printGf2xMat ( const BPU_T_GF2_16x_Matrix in)

Print number as binary string. Print also new line at the end. It will be padded 64 bits.

Parameters
ininput of max 64 bits

Definition at line 33 of file gf2x.c.

void BPU_printGf2xPoly ( const BPU_T_GF2_16x_Poly p,
const BPU_T_Math_Ctx math_ctx 
)

BPU_printGf2xPoly print GF2x polynomial.

Parameters
p
math_ctx

Definition at line 47 of file gf2x.c.

void BPU_printGf2xVec ( const BPU_T_GF2_16x_Vector v)

BPU_printGf2xVec print GF2x vector.

Parameters
v

Definition at line 68 of file gf2x.c.