![]() |
BitPunch McEliece
v0.0.4
|
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | _BPU_T_GF2_Vector |
struct | _BPU_T_GF2_Matrix |
struct | _BPU_T_GF2_Sparse_Poly |
struct | _BPU_T_GF2_QC_Matrix |
struct | _BPU_T_GF2_Sparse_Qc_Matrix |
Macros | |
#define | BPU_gf2MatNullRow(m_pointer, row) memset((void *) ((m_pointer)->elements[row]), 0, (m_pointer)->element_bit_size / 8 * (m_pointer)->elements_in_row) |
Null GF2 matrix row. More... | |
#define | BPU_gf2VecNull(v_pointer) memset((void *) ((v_pointer)->elements), 0, (v_pointer)->element_bit_size / 8 * (v_pointer)->elements_in_row) |
Null GF2 vector. More... | |
Typedefs | |
typedef uint32_t | BPU_T_GF2 |
typedef struct _BPU_T_GF2_Vector | BPU_T_GF2_Vector |
typedef struct _BPU_T_GF2_Matrix | BPU_T_GF2_Matrix |
typedef BPU_T_GF2_Vector | BPU_T_GF2_Poly |
typedef struct _BPU_T_GF2_Sparse_Poly | BPU_T_GF2_Sparse_Poly |
typedef struct _BPU_T_GF2_QC_Matrix | BPU_T_GF2_QC_Matrix |
typedef struct _BPU_T_GF2_Sparse_Qc_Matrix | BPU_T_GF2_Sparse_Qc_Matrix |
Functions | |
void | BPU_gf2MatFree (BPU_T_GF2_Matrix **m) |
Free dynamically or statically allocated matrix. More... | |
void | BPU_gf2VecFree (BPU_T_GF2_Vector **v) |
Free dynamically or statically allocated vector. More... | |
int | BPU_gf2MatMalloc (BPU_T_GF2_Matrix **m, int rows, int cols) |
int | BPU_gf2VecMalloc (BPU_T_GF2_Vector **v, int len) |
int | BPU_gf2VecResize (BPU_T_GF2_Vector *v, int len) |
BPU_gf2VecResize Resize vecor. More... | |
int | BPU_gf2VecMallocElements (BPU_T_GF2_Vector *v, int len) |
BPU_gf2VecMallocElements Malloc vector elements and set to zero. More... | |
int | BPU_gf2PolyMalloc (BPU_T_GF2_Poly *p, int len) |
void | BPU_gf2PolyFree (BPU_T_GF2_Poly *p, int is_dyn) |
void | BPU_gf2SparsePolyMalloc (BPU_T_GF2_Sparse_Poly *p, int weight) |
void | BPU_gf2SparsePolyFree (BPU_T_GF2_Sparse_Poly *p, int is_dyn) |
int | BPU_gf2QcMatrixMalloc (BPU_T_GF2_QC_Matrix *v, int element_count, int element_size, int isVertical, int is_I_appended) |
void | BPU_gf2QcMatrixFree (BPU_T_GF2_QC_Matrix *v, int is_dyn) |
void | BPU_gf2SparseQcMatrixMalloc (BPU_T_GF2_Sparse_Qc_Matrix *v, int element_count, int element_size, int isVertical) |
void | BPU_gf2SparseQcMatrixFree (BPU_T_GF2_Sparse_Qc_Matrix *v, int is_dyn) |
#define BPU_gf2MatNullRow | ( | m_pointer, | |
row | |||
) | memset((void *) ((m_pointer)->elements[row]), 0, (m_pointer)->element_bit_size / 8 * (m_pointer)->elements_in_row) |
Null GF2 matrix row.
Null GF2 matrix row.
[out] | m_pointer | pointer to GF2 matrix |
[in] | row | row to null |
Definition at line 105 of file gf2types.h.
#define BPU_gf2VecNull | ( | v_pointer | ) | memset((void *) ((v_pointer)->elements), 0, (v_pointer)->element_bit_size / 8 * (v_pointer)->elements_in_row) |
Null GF2 vector.
Null GF2 vector.
[out] | v_pointer | pointer to GF2 vector |
Definition at line 112 of file gf2types.h.
typedef uint32_t BPU_T_GF2 |
Binary representation GF2
Definition at line 26 of file gf2types.h.
typedef struct _BPU_T_GF2_Matrix BPU_T_GF2_Matrix |
Matrix representation over GF2. Every element is one bit.
typedef BPU_T_GF2_Vector BPU_T_GF2_Poly |
Polynomial over GF2, represented as Vector. Indexes are stored in elements, degree of polynomial is len - 1
Definition at line 55 of file gf2types.h.
typedef struct _BPU_T_GF2_QC_Matrix BPU_T_GF2_QC_Matrix |
Quasi-cyclic matrix over GF2. Cyclic matrices are stored as polynomials. Matrix can have multiple cyclic matrices (but just one in row and more in columns, or in reverse) The orientation of is set in isVertical. For appended identity matrix in left set is_I_appended to 1.
typedef struct _BPU_T_GF2_Sparse_Poly BPU_T_GF2_Sparse_Poly |
Sparse polynomial over GF2. More effective than BPU_T_GF2_Poly for low weight polynomials. Every set coefficient is stored in array of indexes.
typedef struct _BPU_T_GF2_Sparse_Qc_Matrix BPU_T_GF2_Sparse_Qc_Matrix |
Quasi-cyclic matrix over GF2 with sparse cyclic matrices. More effective than BPU_T_QC_Matrix_GF2 for low weight cyclic matrices. Matrix can have multiple cyclic matrices (but just one in row and more in columns, or in reverse) The orientation of is set in isVertical.
typedef struct _BPU_T_GF2_Vector BPU_T_GF2_Vector |
Row vector GF2 representation. Every element is one bit.
void BPU_gf2MatFree | ( | BPU_T_GF2_Matrix ** | m | ) |
Free dynamically or statically allocated matrix.
Free dynamically or statically allocated matrix GF2.
[out] | *m | address of matrix object |
Definition at line 29 of file gf2types.c.
int BPU_gf2MatMalloc | ( | BPU_T_GF2_Matrix ** | m, |
int | rows, | ||
int | cols | ||
) |
Allocate memory for matrix GF2. It also nulls new matrix. After work you have to free memory using call BPU_freeMatGF2
rows | rows |
cols | cols |
Definition at line 54 of file gf2types.c.
void BPU_gf2PolyFree | ( | BPU_T_GF2_Poly * | p, |
int | is_dyn | ||
) |
Free dynamically or statically allocated polynomial over GF2.
p | polynomial to free |
is_dyn | boolean param, if 0 do not free object self, else free also object |
Definition at line 187 of file gf2types.c.
int BPU_gf2PolyMalloc | ( | BPU_T_GF2_Poly * | p, |
int | len | ||
) |
Allocate memory for polynomial over GF2. Allocate memory, so after work it has to be freed by using call BPU_gf2PolyFree.
p | polynomial to allocate |
len | length of polynomial (length - 1 = degree of polynomial) |
Definition at line 195 of file gf2types.c.
void BPU_gf2QcMatrixFree | ( | BPU_T_GF2_QC_Matrix * | v, |
int | is_dyn | ||
) |
Free dynamically or statically allocated quasi-cyclic matrix over GF2.
v | quasi-cyclic matrix |
is_dyn | boolean param, if 0 do not free object self, else free also object |
Definition at line 251 of file gf2types.c.
int BPU_gf2QcMatrixMalloc | ( | BPU_T_GF2_QC_Matrix * | v, |
int | element_count, | ||
int | element_size, | ||
int | isVertical, | ||
int | is_I_appended | ||
) |
Allocate memory for quasi-cyclic matrix over GF2. Allocate memory, so after work it has to be freed by using call BPU_gf2QcMatrixFree.
v | quasi-cyclic matrix |
element_count | count of cyclic elements |
element_size | size of one cyclic element |
isVertical | boolean, if 1, elements are in vertical orientation, if 0 horizontal orientation |
is_I_appended | boolean, if 1, identity matrix is appended to the left, if 0, no identity matrix |
Definition at line 220 of file gf2types.c.
void BPU_gf2SparsePolyFree | ( | BPU_T_GF2_Sparse_Poly * | p, |
int | is_dyn | ||
) |
Free dynamically or statically allocated sparse polynomial over GF2.
p | sparse polynomial to free |
is_dyn | boolean param, if 0 do not free object self, else free also object |
Definition at line 147 of file gf2types.c.
void BPU_gf2SparsePolyMalloc | ( | BPU_T_GF2_Sparse_Poly * | p, |
int | weight | ||
) |
Allocate memory for sparse polynomial over GF2. Allocate memory, so after work it has to be freed by using call BPU_gf2SparsePolyFree.
p | sparse polynomial to allocate |
weight | weight of sparse polynomial |
Definition at line 140 of file gf2types.c.
void BPU_gf2SparseQcMatrixFree | ( | BPU_T_GF2_Sparse_Qc_Matrix * | v, |
int | is_dyn | ||
) |
Free dynamically or statically allocated sparse quasi-cyclic matrix over GF2.
v | sparse quasi-cyclic matrix |
is_dyn | boolean param, if 0 do not free object self, else free also object |
Definition at line 174 of file gf2types.c.
void BPU_gf2SparseQcMatrixMalloc | ( | BPU_T_GF2_Sparse_Qc_Matrix * | v, |
int | element_count, | ||
int | element_size, | ||
int | isVertical | ||
) |
Allocate memory for sparse quasi-cyclic matrix over GF2. Allocate memory, so after work it has to be freed by using call BPU_gf2SparseQcMatrixFree.
v | sparse quasi-cyclic matrix |
element_count | count of cyclic elements |
element_size | size of one cyclic element |
isVertical | boolean, if 1, elements are in vertical orientation, if 0 horizontal orientation |
Definition at line 154 of file gf2types.c.
void BPU_gf2VecFree | ( | BPU_T_GF2_Vector ** | v | ) |
Free dynamically or statically allocated vector.
Free dynamically or statically allocated vector GF2.
[out] | *m | address of vector object |
Definition at line 45 of file gf2types.c.
int BPU_gf2VecMalloc | ( | BPU_T_GF2_Vector ** | v, |
int | len | ||
) |
Allocate memory for vector GF2. It also null vector. After work you have to free memory using call BPU_freeVecGF2.
len | len of vector |
Definition at line 97 of file gf2types.c.
int BPU_gf2VecMallocElements | ( | BPU_T_GF2_Vector * | v, |
int | len | ||
) |
BPU_gf2VecMallocElements Malloc vector elements and set to zero.
v | |
len |
Definition at line 114 of file gf2types.c.
int BPU_gf2VecResize | ( | BPU_T_GF2_Vector * | v, |
int | len | ||
) |