YAARX: Yet Another ARX Toolkit  0.1
 All Data Structures Files Functions Variables Macros Pages
adp-xor3.hh File Reference

Header file for adp-xor3.cc: More...

Go to the source code of this file.

Macros

#define ADP_XOR3_MSIZE   16
 
#define ADP_XOR3_NMATRIX   16
 
#define ADP_XOR3_NINPUTS   3
 
#define ADP_XOR3_ISTATE   8
 
#define ADP_XOR3_COLSUM   8
 
#define ADP_XOR3_NORM   1.0 /(double)ADP_XOR3_COLSUM
 

Functions

void adp_xor3_alloc_matrices (gsl_matrix *A[2][2][2][2])
 
void adp_xor3_free_matrices (gsl_matrix *A[2][2][2][2])
 
void adp_xor3_print_matrices (gsl_matrix *A[2][2][2][2])
 
void adp_xor3_print_matrices_sage (gsl_matrix *A[2][2][2][2])
 
void adp_xor3_normalize_matrices (gsl_matrix *A[2][2][2][2])
 
int adp_xor3_states_to_index (int s1, int s2, int s3, int s4)
 
void adp_xor3_sf (gsl_matrix *A[2][2][2][2])
 
double adp_xor3 (gsl_matrix *A[2][2][2][2], uint32_t da, uint32_t db, uint32_t dc, uint32_t dd)
 
double adp_xor3_exper (const uint32_t da, const uint32_t db, const uint32_t dc, const uint32_t dd)
 

Detailed Description

Header file for adp-xor3.cc:

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

Macro Definition Documentation

#define ADP_XOR3_COLSUM   8

Sum of non-zero elements in one column of the $3\oplus$ matrices.

#define ADP_XOR3_ISTATE   8

Initial state for computing the $\mathrm{adp}^{3\oplus}$ S-function.

#define ADP_XOR3_MSIZE   16

Number of state values in the $\mathrm{adp}^{3\oplus}$ S-functions.

#define ADP_XOR3_NINPUTS   3

Number of inputs to the $3\oplus$ operation.

#define ADP_XOR3_NMATRIX   16

Number of $\mathrm{adp}^{3\oplus}$ matrices.

#define ADP_XOR3_NORM   1.0 /(double)ADP_XOR3_COLSUM

Normalization factor for the $\mathrm{adp}^{3\oplus}$ matrices.

Function Documentation

double adp_xor3 ( gsl_matrix *  A[2][2][2][2],
uint32_t  da,
uint32_t  db,
uint32_t  dc,
uint32_t  dd 
)

The additive differential probability (ADP) of $\mathrm{adp}^{3\oplus}$. Complexity: $O(n)$.

Parameters
Atransition probability matrices for $\mathrm{adp}^{3\oplus}$ computed with adp_xor3_sf.
dafirst input difference.
dbsecond input difference.
dcthird input difference.
ddoutput difference.
Returns
$\mathrm{adp}^{3\oplus}(da,db,dc \rightarrow dd)$.
See Also
adp_xor
void adp_xor3_alloc_matrices ( gsl_matrix *  A[2][2][2][2])

Allocate memory for the transition probability matrices for $\mathrm{adp}^{3\oplus}$.

Parameters
Atransition probability matrices for $\mathrm{adp}^{3\oplus}$.
See Also
adp_xor3_free_matrices
double adp_xor3_exper ( const uint32_t  da,
const uint32_t  db,
const uint32_t  dc,
const uint32_t  dd 
)

The additive differential probability (ADP) of $\mathrm{adp}^{3\oplus}$ computed experimentally over all inputs. Complexity: $O(2^{3n})$.

Parameters
dafirst input difference.
dbsecond input difference.
dcthird input difference.
ddoutput difference.
Returns
$\mathrm{adp}^{3\oplus}(da,db,dc \rightarrow dd)$.
See Also
adp_xor
void adp_xor3_free_matrices ( gsl_matrix *  A[2][2][2][2])

Free memory reserved by a previous call to adp_xor3_alloc_matrices.

Parameters
Atransition probability matrices for $\mathrm{adp}^{3\oplus}$.
void adp_xor3_normalize_matrices ( gsl_matrix *  A[2][2][2][2])

Transform the elements of A into probabilities.

Parameters
Atransition probability matrices for $\mathrm{adp}^{3\oplus}$.
void adp_xor3_print_matrices ( gsl_matrix *  A[2][2][2][2])

Print the matrices for $\mathrm{adp}^{3\oplus}$.

Parameters
Atransition probability matrices for $\mathrm{adp}^{3\oplus}$.
void adp_xor3_print_matrices_sage ( gsl_matrix *  A[2][2][2][2])

Print the matrices for $\mathrm{adp}^{3\oplus}$ in a format readable by the computer algebra system Sage (http://www.sagemath.org/).

Parameters
Atransition probability matrices for $\mathrm{adp}^{3\oplus}$.
void adp_xor3_sf ( gsl_matrix *  A[2][2][2][2])

S-function for $\mathrm{adp}^{3\oplus}$: $\mathrm{adp}^{3\oplus}(da,db,dc \rightarrow dd)$.

Parameters
Azero-initialized set of matrices.
Returns
Transition probability matrices A for $\mathrm{adp}^{3\oplus}(da,db,dc \rightarrow dd)$.

$A[2][2][2][2] = A[da[i]][db[i]][dc[i]][dd[i]]$, where

  • $da[i]$ : the i-th bit of the first input difference.
  • $db[i]$ : the i-th bit of the second input difference.
  • $dc[i]$ : the i-th bit of the third input difference.
  • $dd[i]$ : the i-th bit of the output difference.
See Also
adp_xor_sf
int adp_xor3_states_to_index ( int  s1,
int  s2,
int  s3,
int  s4 
)

Transform the values of the four states of the S-function for $\mathrm{adp}^{3\oplus}$ (adp_xor3_sf) into an index.

Parameters
s1state corresponding to the first input difference.
s2state corresponding to the second input difference.
s3state corresponding to the third input difference.
s4state corresponding to the output difference.
Returns
the index $i = (s_4 + 1)2^3 + s_3 2^2 + s_2 2 + s_1$