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

The ADD differential probability of right shift followed by XOR: $\mathrm{adp}^{\gg\oplus}$. More...

#include "common.hh"
#include "adp-xor.hh"
#include "adp-shift.hh"
#include "adp-rsh-xor.hh"

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

The ADD differential probability of right shift followed by XOR: $\mathrm{adp}^{\gg\oplus}$.

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

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) $.