![]() |
YAARX: Yet Another ARX Toolkit
0.1
|
Header file for xdp-add-diff-set.cc: More...
Go to the source code of this file.
Data Structures | |
| struct | diff_set_t |
Macros | |
| #define | XDP_ADD_DSET_MSIZE 8 |
| #define | XDP_ADD_DSET_NMATRIX 8 |
| #define | XDP_ADD_DSET_NMATRIX_ALL 27 |
| #define | XDP_ADD_DSET_NISTATES 4 |
| #define | STAR 1 |
| #define | FIXED 0 |
| #define | STAR_VALUE 2 |
| #define | XDP_ADD_DSET_NVALUES 3 |
Functions | |
| bool | is_dset_equal (const diff_set_t da_set, const diff_set_t db_set) |
| uint64_t | xdp_add_dset_size (diff_set_t da_set) |
| void | xdp_add_input_diff_to_output_dset (WORD_T da, WORD_T db, diff_set_t *dc_set) |
| void | xdp_add_dset_gen_diff_all (const diff_set_t dc_set, std::vector< WORD_T > *dc_set_all) |
| void | xdp_add_dset_gen_diff_hamming_limit (const diff_set_t dc_set, const uint32_t hw_limit, std::vector< WORD_T > *dc_set_all) |
| void | xdp_add_input_dsets_to_input_diffs (const diff_set_t da_set, const diff_set_t db_set, WORD_T da[2], WORD_T db[2]) |
| void | xdp_add_input_dset_to_output_dset (gsl_matrix *AA[2][2][2], const diff_set_t da_set, const diff_set_t db_set, diff_set_t *dc_set) |
| void | xdp_add_input_dset_to_output_dset_i (uint32_t i, gsl_matrix *AA[2][2][2], const diff_set_t da_set, const diff_set_t db_set, diff_set_t *dc_set_in, double *r_in, diff_set_t *dc_set_max, double *r_max) |
| void | xdp_add_input_dset_to_output_dset_rec (gsl_matrix *AA[2][2][2], const diff_set_t da_set, const diff_set_t db_set, diff_set_t *dc_set_max) |
| void | xdp_add_dset_alloc_matrices (gsl_matrix *A[2][2][2]) |
| void | xdp_add_dset_alloc_matrices_all (gsl_matrix *A[3][3][3]) |
| void | xdp_add_dset_free_matrices (gsl_matrix *A[2][2][2]) |
| void | xdp_add_dset_free_matrices_all (gsl_matrix *A[3][3][3]) |
| void | xdp_add_dset_gen_matrices (gsl_matrix *A[2][2][2]) |
| void | xdp_add_dset_gen_matrices_all (gsl_matrix *AA[3][3][3], gsl_matrix *A[2][2][2]) |
| void | xdp_add_dset_print_matrices (gsl_matrix *A[2][2][2]) |
| void | xdp_add_dset_print_matrices_all (gsl_matrix *A[3][3][3]) |
| void | xdp_add_dset_print_matrix (gsl_matrix *A) |
| void | xdp_add_dset_gen_matrix (const uint32_t i, gsl_matrix *M, gsl_matrix *A[2][2][2], const diff_set_t da_set, const diff_set_t db_set, const diff_set_t dc_set) |
| void | xdp_add_dset_init_states (const uint32_t pos, gsl_vector *C, const diff_set_t da_set, const diff_set_t db_set, const diff_set_t dc_set) |
| double | xdp_add_dset (gsl_matrix *A[2][2][2], const uint32_t word_size, const diff_set_t da_set, const diff_set_t db_set, const diff_set_t dc_set) |
| double | xdp_add_dset_all (gsl_matrix *AA[3][3][3], const uint32_t word_size, const diff_set_t da_set, const diff_set_t db_set, const diff_set_t dc_set) |
| void | xdp_add_dset_print_set (const diff_set_t da_set) |
| double | xdp_add_dset_exper (gsl_matrix *A[2][2][2], const diff_set_t da_set, const diff_set_t db_set, const diff_set_t dc_set) |
| void | rmax_xdp_add_dset_i (const uint32_t k_init, const uint32_t k, const uint32_t n, double *r, double *p, diff_set_t *dc_set, gsl_matrix *A[3][3][3], gsl_vector *B[WORD_SIZE+1], gsl_vector *C_in, const diff_set_t da_set, const diff_set_t db_set, diff_set_t *dc_set_max, double *r_max, double *p_max, bool b_single_diff) |
| double | rmax_xdp_add_dset (gsl_matrix *A[3][3][3], const diff_set_t da_set, const diff_set_t db_set, diff_set_t *dc_set_max, bool b_single_diff) |
| double | max_xdp_add_dset_exper (gsl_matrix *A[2][2][2], const diff_set_t da_set, const diff_set_t db_set, diff_set_t *max_dc_set) |
| double | max_xdp_add_dset (const diff_set_t da_set, const diff_set_t db_set, diff_set_t *dc_set) |
| diff_set_t | xor_dset (diff_set_t da_set, diff_set_t db_set) |
| diff_set_t | lrot_dset (diff_set_t da_set, uint32_t rot_const) |
| bool | is_inset (uint32_t da, diff_set_t da_set) |
Variables | |
| uint32_t | XDP_ADD_DSET_ISTATES [XDP_ADD_DSET_NISTATES] |
Header file for xdp-add-diff-set.cc:
| #define FIXED 0 |
If a bit in the member fixed in a diff_set_t structure is set to FIXED, then the corresponding bit in the difference diff is fixed to its given value.
| #define STAR 1 |
If a bit in the member fixed in a diff_set_t structure is set to STAR, then the corresponding bit in the difference diff can be either 1 or 0.
| #define XDP_ADD_DSET_MSIZE 8 |
| #define XDP_ADD_DSET_NMATRIX 8 |
| #define XDP_ADD_DSET_NMATRIX_ALL 27 |
| bool is_dset_equal | ( | const diff_set_t | da_set, |
| const diff_set_t | db_set | ||
| ) |
Check if two sets of XOR differences are equal.
| da_set | set of XOR differences. |
| db_set | set of XOR differences. |
| void rmax_xdp_add_dset_i | ( | const uint32_t | k_init, |
| const uint32_t | k, | ||
| const uint32_t | n, | ||
| double * | r, | ||
| double * | p, | ||
| diff_set_t * | dc_set, | ||
| gsl_matrix * | A[3][3][3], | ||
| gsl_vector * | B[WORD_SIZE+1], | ||
| gsl_vector * | C_in, | ||
| const diff_set_t | da_set, | ||
| const diff_set_t | db_set, | ||
| diff_set_t * | dc_set_max, | ||
| double * | r_max, | ||
| double * | p_max, | ||
| bool | b_single_diff | ||
| ) |
| double xdp_add_dset | ( | gsl_matrix * | A[2][2][2], |
| const uint32_t | word_size, | ||
| const diff_set_t | da_set, | ||
| const diff_set_t | db_set, | ||
| const diff_set_t | dc_set | ||
| ) |
The XOR probability of ADD with respect to sets of XOR differences diff_set_t . This is probability with which input sets
propagate to output set
:
.
| AA | transition probability matrices for , computed with xdp_add_dset_gen_matrix . |
| word_size | the length of words in bits (cf. WORD_SIZE). |
| da_set | set of input XOR differences . |
| db_set | set of input XOR differences . |
| dc_set | set of output XOR differences . |
. | double xdp_add_dset_all | ( | gsl_matrix * | AA[3][3][3], |
| const uint32_t | word_size, | ||
| const diff_set_t | da_set, | ||
| const diff_set_t | db_set, | ||
| const diff_set_t | dc_set | ||
| ) |
The XOR probability of ADD with respect to sets of XOR differences diff_set_t output set
:
.
| AA | transition probability matrices for , computed with xdp_add_dset_gen_matrices_all . |
| word_size | the length of words in bits (cf. WORD_SIZE). |
| da_set | set of input XOR differences . |
| db_set | set of input XOR differences . |
| dc_set | set of output XOR differences . |
. | void xdp_add_dset_alloc_matrices | ( | gsl_matrix * | A[2][2][2] | ) |
Allocate memory for the transition probability matrices for
.
| A | transition probability matrices for . |
| void xdp_add_dset_alloc_matrices_all | ( | gsl_matrix * | A[3][3][3] | ) |
Allocate memory for all transition probability matrices for
.
| A | all transition probability matrices for . |
| void xdp_add_dset_free_matrices | ( | gsl_matrix * | A[2][2][2] | ) |
Free memory reserved by a previous call to xdp_add_dset_alloc_matrices .
| A | transition probability matrices for . |
| void xdp_add_dset_free_matrices_all | ( | gsl_matrix * | A[3][3][3] | ) |
Free memory reserved by a previous call to xdp_add_dset_alloc_matrices_all .
| A | all transition probability matrices for . |
| void xdp_add_dset_gen_diff_all | ( | const diff_set_t | dc_set, |
| std::vector< WORD_T > * | dc_set_all | ||
| ) |
Generate all XOR differences that belong to a given input set
.
| da_set | set of input XOR differences in compact represenatation diff_set_t . |
| dc_set_all | a vector of all XOR differences that compose in explicit form. |
| void xdp_add_dset_gen_diff_hamming_limit | ( | const diff_set_t | dc_set, |
| const uint32_t | hw_limit, | ||
| std::vector< WORD_T > * | dc_set_all | ||
| ) |
Generate all XOR differences that belong to a given input set
and have Hamming weight less than or equal to a pre-defined limit.
| da_set | set of input XOR differences in compact represenatation diff_set_t . |
| dc_set_all | a vector of all XOR differences that compose in explicit form. |
| hw_limit | Hamming weight limit |
| void xdp_add_dset_gen_matrices | ( | gsl_matrix * | A[2][2][2] | ) |
Generate the transition probability matrices for
.
| A | transition probability matrices for . |
| void xdp_add_dset_gen_matrices_all | ( | gsl_matrix * | AA[3][3][3], |
| gsl_matrix * | A[2][2][2] | ||
| ) |
Generate all matrices for
. from all valid matrices for this position precomputed with xdp_add_dset_gen_matrices .
| AA | all transition probability matrices for . |
| A | transition probability matrices for . |
| void xdp_add_dset_gen_matrix | ( | const uint32_t | i, |
| gsl_matrix * | M, | ||
| gsl_matrix * | A[2][2][2], | ||
| const diff_set_t | da_set, | ||
| const diff_set_t | db_set, | ||
| const diff_set_t | dc_set | ||
| ) |
Generate the matrix for the i-th bit position, as the sum of all valid matrices for this position
| i | bit postion: WORD_SIZE. |
| M | composite transition probability matrix compued as a sum of some matrices A depending on the values of the set st at this bit popsition: . |
| A | transition probability matrices for . |
| da_set | set of input XOR differences. |
| db_set | set of input XOR differences. |
| dc_set | set of output XOR differences. |
| void xdp_add_dset_init_states | ( | const uint32_t | pos, |
| gsl_vector * | C, | ||
| const diff_set_t | da_set, | ||
| const diff_set_t | db_set, | ||
| const diff_set_t | dc_set | ||
| ) |
Initialize the states at position pos depending on the values of the sets at this position. pos can be 0 or (WORD_SIZE - 1). If it is 0, valid states are 0, 3, 5, 6 (cf. XDP_ADD_DSET_ISTATES), otherwise all states are valid.
| pos | bit position: 0 or (WORD_SIZE - 1). |
| C | column vector of size XDP_ADD_DSET_MSIZE . |
| da_set | set of input XOR differences. |
| db_set | set of input XOR differences. |
| dc_set_in | set of output XOR differences. |
| void xdp_add_dset_print_matrices | ( | gsl_matrix * | A[2][2][2] | ) |
Print all matrices for
.
| A | transition probability matrices for . |
| void xdp_add_dset_print_matrices_all | ( | gsl_matrix * | A[3][3][3] | ) |
Print all matrices for
.
| A | all transition probability matrices for . |
| void xdp_add_dset_print_matrix | ( | gsl_matrix * | A | ) |
Print a single matrix for
.
| A | transition probability matrix for . . |
| uint64_t xdp_add_dset_size | ( | diff_set_t | da_set | ) |
Compute the number of XOR differencces in the set da_set .
| da_set | a set of input differences. |
da_set . | void xdp_add_input_diff_to_output_dset | ( | WORD_T | da, |
| WORD_T | db, | ||
| diff_set_t * | dc_set | ||
| ) |
From two fixed input differences da and db to the ADD operation, compute a set of output differences C such that
. The algorithm is based on max_xdp_add_lm . It sets
STAR if
and
otherwise.
| da | input XOR difference. |
| db | input XOR difference. |
| dc_set | set of output XOR differences. |
| void xdp_add_input_dset_to_output_dset | ( | gsl_matrix * | AA[2][2][2], |
| const diff_set_t | da_set, | ||
| const diff_set_t | db_set, | ||
| diff_set_t * | dc_set | ||
| ) |
From given sets of input XOR differences
and
compute a set of output differences
by greedily bitwise maximizing the ratio:
where
and
is the size of the output set
.
| AA | transition probability matrices for , computed with xdp_add_dset_gen_matrix . |
| da_set | set of input XOR differences. |
| db_set | set of input XOR differences. |
| dc_set | set of output XOR differences. |
| void xdp_add_input_dset_to_output_dset_i | ( | uint32_t | i, |
| gsl_matrix * | AA[2][2][2], | ||
| const diff_set_t | da_set, | ||
| const diff_set_t | db_set, | ||
| diff_set_t * | dc_set_in, | ||
| double * | r_in, | ||
| diff_set_t * | dc_set_max, | ||
| double * | r_max | ||
| ) |
From given sets of input XOR differences
and
compute a set of output differences
that maximizes the ratio:
where
and
is the size of the output set
:
.
| AA | transition probability matrices for , computed with xdp_add_dset_gen_matrix . |
| da_set | set of input XOR differences. |
| db_set | set of input XOR differences. |
| dc_set_in | set of output XOR differences. |
| r_in | ratio . |
| dc_set_max | output set that maximizes . |
| r_max | the maximum ratio . |
| void xdp_add_input_dset_to_output_dset_rec | ( | gsl_matrix * | AA[2][2][2], |
| const diff_set_t | da_set, | ||
| const diff_set_t | db_set, | ||
| diff_set_t * | dc_set_max | ||
| ) |
Wrapper function for xdp_add_input_dset_to_output_dset_i .
| AA | transition probability matrices for , computed with xdp_add_dset_gen_matrix . |
| da_set | set of input XOR differences. |
| db_set | set of input XOR differences. |
| dc_set_max | output set that maximizes the ratio . |
| void xdp_add_input_dsets_to_input_diffs | ( | const diff_set_t | da_set, |
| const diff_set_t | db_set, | ||
| WORD_T | da[2], | ||
| WORD_T | db[2] | ||
| ) |
From input sets
and
for
, generate two pairs of input differences:
and
such that
if
STAR and
,
otherwise;
.
| da_set | set of input XOR differences. |
| db_set | set of input XOR differences. |
| output | XOR differences . |
| output | XOR differences . |
| uint32_t XDP_ADD_DSET_ISTATES[XDP_ADD_DSET_NISTATES] |
.