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

Header file for adp-rsh-xor.cc: More...

Go to the source code of this file.

Macros

#define ADP_RSH_XOR_NSTATES   3
 
#define ADP_RSH_XOR_NPOS   3
 
#define ADP_RSH_XOR_MSIZE   (1L << ADP_RSH_XOR_NSTATES)
 
#define ADP_RSH_XOR_NINPUTS   2
 
#define ADP_RSH_XOR_NOUTPUTS   1
 
#define ADP_RSH_XOR_COLSUM   4
 
#define ADP_RSH_XOR_NORM   1.0 /(double)ADP_RSH_XOR_COLSUM
 

Functions

uint32_t rsh_xor (uint32_t a, uint32_t x, int r)
 
double adp_rsh_xor_exper (const uint32_t da, const uint32_t dx, const uint32_t db, const int r)
 
void adp_rsh_xor_alloc_matrices (gsl_matrix *A[3][2][2][2])
 
void adp_rsh_xor_free_matrices (gsl_matrix *A[3][2][2][2])
 
void adp_rsh_xor_normalize_matrices (gsl_matrix *A[3][2][2][2])
 
void adp_rsh_xor_print_matrices (gsl_matrix *A[3][2][2][2])
 
void adp_rsh_xor_sf (gsl_matrix *A[3][2][2][2])
 
double adp_rsh_xor (gsl_matrix *A[3][2][2][2], uint32_t da, uint32_t dx, uint32_t db, int r)
 
double adp_rsh_xor_approx (uint32_t da, uint32_t dx, uint32_t db, int r)
 

Detailed Description

Macro Definition Documentation

#define ADP_RSH_XOR_COLSUM   4

Sum of the non-zero elements in one column of the $\mathrm{adp}^{\gg\oplus}$ matrices.

#define ADP_RSH_XOR_MSIZE   (1L << ADP_RSH_XOR_NSTATES)

Size of the transition probability matrices for $\mathrm{adp}^{\gg\oplus}$.

#define ADP_RSH_XOR_NINPUTS   2

Number of inputs to the operation $(\gg\oplus)$.

#define ADP_RSH_XOR_NORM   1.0 /(double)ADP_RSH_XOR_COLSUM

Normalization factor for transforming the elements of the matrices into probabilities.

#define ADP_RSH_XOR_NOUTPUTS   1

Number of outputs from the operation $(\gg\oplus)$.

#define ADP_RSH_XOR_NPOS   3

Special bit positions in the computation of $\mathrm{adp}^{\gg\oplus}$.

#define ADP_RSH_XOR_NSTATES   3

Number of states of the S-function for $\mathrm{adp}^{\gg\oplus}$.

Function Documentation

double adp_rsh_xor ( gsl_matrix *  A[3][2][2][2],
uint32_t  da,
uint32_t  dx,
uint32_t  db,
int  r 
)

The ADD differential probability of $({\gg\oplus})$ (RSH-XOR) computed experimentally over all inputs. Complexity: $O(n)$.

Parameters
Atransition probability matrices for $\mathrm{adp}^{\gg\oplus}$.
dainput difference.
dxinput difference.
dboutput difference.
rshift constant.
Returns
$\mathrm{adp}^{\gg\oplus}(r | da, dx \rightarrow db)$.
See Also
adp_rsh_xor_exper
void adp_rsh_xor_alloc_matrices ( gsl_matrix *  A[3][2][2][2])

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

Parameters
Atransition probability matrices for $\mathrm{adp}^{\gg\oplus}$.
See Also
adp_rsh_xor_free_matrices
double adp_rsh_xor_approx ( uint32_t  da,
uint32_t  dx,
uint32_t  db,
int  r 
)

Approximation of $\mathrm{adp}^{\gg\oplus}$ obtained as the multiplication of the differential probabilities $\mathrm{adp}^{\gg}$ and $\mathrm{adp}^{\oplus}$.

Parameters
dainput difference.
dxinput difference.
dboutput difference.
rshift constant.
Returns
$\mathrm{adp}^{\gg\oplus}(r | da, dx \rightarrow db) \approx \mathrm{adp}^{\gg} \cdot \mathrm{adp}^{\oplus} $.
See Also
adp_xor, adp_rsh
double adp_rsh_xor_exper ( const uint32_t  da,
const uint32_t  dx,
const uint32_t  db,
const int  r 
)

The ADD differential probability of RSH-XOR computed experimentally over all inputs. Complexity: $O(2^{2n})$.

Parameters
dainput difference.
dxinput difference.
dboutput difference.
rshift constant.
Returns
$\mathrm{adp}^{\gg\oplus}(r | da, dx \rightarrow db)$.
See Also
adp_rsh_xor
void adp_rsh_xor_free_matrices ( gsl_matrix *  A[3][2][2][2])

Free memory reserved for the transition probability matrices for $\mathrm{adp}^{\gg\oplus}$.

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

Transform the elements of A into probabilities.

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

Print the elements of A.

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

S-function for the operation $({\gg\oplus})$ (RSH-XOR).

Parameters
Azero-initialized set of matrices.
Returns
Transition probability matrices A for $\mathrm{adp}^{\gg\oplus}$.

$A[3][2][2][2] = A[j][da[i]][dx[i+r]][db[i]]$, where $da[i]$ denotes the i-th bit of $da$, $n$ is the word size, $r$ is the shift constant, $i$ is the bit position and $j$ is a special bit position with three possible values:

  • $ j = 0 : 0 \le i < n - r$.
  • $ j = 1 : n - r < i < n$.
  • $ j = 2 : i = n - r$.
uint32_t rsh_xor ( uint32_t  a,
uint32_t  x,
int  r 
)

The sequence of operations right shift (RSH) followed by an XOR (RSH-XOR).

Parameters
ainput to XOR.
xinput to RSH.
rshift constant.
Returns
$ b = a \oplus (x \gg r) $.