-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgf4096x.h
34 lines (26 loc) · 1.1 KB
/
gf4096x.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef GF4096X_H
#define GF4096X_H
unsigned int gf4096_multiply( unsigned int lhs, unsigned int rhs );
unsigned int gf4096_inverse( unsigned int elm );
unsigned int gf4096_exp( unsigned int elm, int exponent );
typedef struct
{
unsigned char * data;
/* a single GF(2^12) element takes up 2 bytes; the 4 msb's
* are ignored but for good practice should be set to zero
* always. */
int degree;
} gf4096x;
gf4096x gf4096x_init( int deg );
int gf4096x_copy( gf4096x* dest, gf4096x source );
int gf4096x_destroy( gf4096x p );
int gf4096x_equals( gf4096x lhs, gf4096x rhs );
int gf4096x_is_zero( gf4096x op );
unsigned int gf4096x_eval( gf4096x polynomial, unsigned int point );
int gf4096x_add( gf4096x* dest, gf4096x lhs, gf4096x rhs );
int gf4096x_multiply( gf4096x* dest, gf4096x lhs, gf4096x rhs );
int gf4096x_multiply_constant_shift( gf4096x* dest, gf4096x poly, unsigned int constant, int shift );
int gf4096x_divide( gf4096x* quo, gf4096x* rem, gf4096x num, gf4096x den );
int gf4096x_xgcd( gf4096x* a, gf4096x* b, gf4096x* g, gf4096x x, gf4096x y );
int gf4096x_print( gf4096x p );
#endif