YAARX: Yet Another ARX Toolkit  0.1
 All Data Structures Files Functions Variables Macros Pages
linear-code-tests.cc File Reference

Experiments with linear codes for SK design. More...

#include "common.hh"
#include "xdp-add.hh"
#include "max-xdp-add.hh"
#include "linear-code-tests-aux.cc"

Macros

#define LCODE_GEN_MATRIX_NROWS   2
 
#define LCODE_GEN_MATRIX_NCOLS   4
 
#define LCODE_MESSAGE_LEN_K   LCODE_GEN_MATRIX_NROWS
 
#define LCODE_CODEWORD_LEN_N   LCODE_GEN_MATRIX_NCOLS
 
#define LCODE_MIN_DIST_D   2
 

Functions

void lcode_matrix_print (gsl_matrix *A, uint32_t nrows, uint32_t ncols)
 
void lcode_vector_print (gsl_vector *V, uint32_t len)
 
void lcode_vec_to_hex (WORD_T *hex, gsl_vector *vec, uint32_t vec_len)
 
void lcode_hex_to_vec (const WORD_T hex, gsl_vector *vec, uint32_t vec_len)
 
void lcode_matrix_double_to_boolean (gsl_matrix *A, uint32_t nrows, uint32_t ncols)
 
void lcode_vector_double_to_boolean (gsl_vector *vec, uint32_t vec_len)
 
void lcode_encode (gsl_vector *codeword, gsl_vector *message, gsl_matrix *G, uint32_t nrows, uint32_t ncols)
 
void lcode_matrix_init (WORD_T GM[LCODE_GEN_MATRIX_NROWS][LCODE_GEN_MATRIX_NCOLS], gsl_matrix *A, uint32_t nrows, uint32_t ncols)
 
void lcode_codewords (std::vector< WORD_T > *C, gsl_matrix *G, uint32_t message_len)
 
void lcode_codewords_diffs (std::vector< WORD_T > C)
 
double lcode_add_dp_exper (WORD_T da, WORD_T db)
 
uint32_t lcode_ndiff_bits (WORD_T a, WORD_T b)
 
uint32_t lcode_ndiff_bits_no_msb (WORD_T a, WORD_T b)
 
WORD_T speck_sigma_left (const WORD_T x, const WORD_T rot_const)
 
WORD_T speck_sigma_right (const WORD_T x, const WORD_T y, const WORD_T rot_const)
 
WORD_T speck_negation (const WORD_T x)
 
double speck_round_dp_max (const WORD_T r, const WORD_T s, const WORD_T da_in, const WORD_T db_in, WORD_T *da_out, WORD_T *db_out)
 
void speck_diff_seq ()
 
void speck_negation_approximation ()
 
void speck_round_dp ()
 
bool sort_comp_diff_3d_hw_custom (differential_3d_t a, differential_3d_t b)
 
void test_speck_xdp_add_vec ()
 
void test_speck_xdp_add ()
 
void test_speck_xdp_add_two_round ()
 
int main ()
 

Variables

WORD_T g_G [LCODE_GEN_MATRIX_NROWS][LCODE_GEN_MATRIX_NCOLS]
 

Detailed Description

Experiments with linear codes for SK design.

Author
V.Velichkov, vesse.nosp@m.lin..nosp@m.velic.nosp@m.hkov.nosp@m.@uni..nosp@m.lu
Date
2012-2015

Function Documentation

void lcode_encode ( gsl_vector *  codeword,
gsl_vector *  message,
gsl_matrix *  G,
uint32_t  nrows,
uint32_t  ncols 
)

Encode NROWS bit message X into NCOLS bite codeword C using the NROWS x NCOLS generator matrix G as:

C[1 x NCOLS] = X[1 x NROWS] G[NROWS x NCOLS]

void lcode_matrix_double_to_boolean ( gsl_matrix *  A,
uint32_t  nrows,
uint32_t  ncols 
)

Convert matrix of double-s to matrix of Booleans: if an element x is non-zero => set it to (x mod 2); else leave it to zero

void lcode_vector_double_to_boolean ( gsl_vector *  vec,
uint32_t  vec_len 
)

Convert vector of double-s to vector of Booleans: if an element x is non-zero => set it to (x mod 2); else leave it to zero

bool sort_comp_diff_3d_hw_custom ( differential_3d_t  a,
differential_3d_t  b 
)

Compare differential_3d_t structs for use with std::sort

Variable Documentation

WORD_T g_G[LCODE_GEN_MATRIX_NROWS][LCODE_GEN_MATRIX_NCOLS]
Initial value:
= {
{1,0,0,1},
{0,1,1,1}
}