BitPunch McEliece  v0.0.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mathctx.h
Go to the documentation of this file.
1 /*
2 This file is part of BitPunch
3 Copyright (C) 2014-2015 Frantisek Uhrecky <frantisek.uhrecky[what here]gmail.com>
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef BPU_MATHCTX_H
19 #define BPU_MATHCTX_H
20 
21 #include "gf2xtypes.h"
22 
23 // polynomials in format BPU_GF2_POLY_DEG_m where 'm' is mceliece param m
24 #define BPU_GF2_POLY_DEG_5 0x3b
25 #define BPU_GF2_POLY_DEG_6 0x43
26 #define BPU_GF2_POLY_DEG_10 0x71d
27 #define BPU_GF2_POLY_DEG_11 0x805
28 
32 typedef struct _BPU_T_Math_Ctx {
36  uint8_t mod_deg;
37  int ord;
39 
46 int BPU_mathInitCtx(BPU_T_Math_Ctx **ctx, const BPU_T_GF2_16x g, const BPU_T_GF2_16x mod);
48 
56 
57 #endif // BPU_MATHCTX_H
BPU_T_GF2_16x * exp_table
there are all elements referenced by i, so at i-th index is g^i element, g - generator ...
Definition: mathctx.h:33
BPU_T_GF2_16x mod
polynomial modulus
Definition: mathctx.h:35
uint16_t BPU_T_GF2_16x
Definition: gf2xtypes.h:26
int BPU_mathInitCtx(BPU_T_Math_Ctx **ctx, const BPU_T_GF2_16x g, const BPU_T_GF2_16x mod)
Precalculate logaritmic and exponencial tables and initialize structure Aritmetic_Data.
Definition: mathctx.c:24
BPU_T_GF2_16x * log_table
there are all indexes referenced by element, so alpha elemnet (g^i) -> i
Definition: mathctx.h:34
void BPU_mathFreeCtx(BPU_T_Math_Ctx **ctx)
Free dynamiccaly or statically allocated Aritmetic_Data structure.
Definition: mathctx.c:67
struct _BPU_T_Math_Ctx BPU_T_Math_Ctx
int ord
group ord, number of elements
Definition: mathctx.h:37
uint8_t mod_deg
modulo degree, galois finite field GF(2^m)
Definition: mathctx.h:36