![]() |
YAARX: Yet Another ARX Toolkit
0.1
|
Automatic search for XOR differentials in block cipher Simon32 (16 bit words) using either the full DDT or a complete partial DDT for all differences with max Hamming weight 5. More...
#include "common.hh"
#include "xdp-and.hh"
#include "xdp-rot-and.hh"
#include "simon.hh"
#include "simon-xor-threshold-search.hh"
#include "simon-xor-ddt-search.hh"
Functions | |
bool | simon_comp_differentials_npairs (differential_t a, differential_t b) |
bool | simon_comp_differentials_diffs (differential_t a, differential_t b) |
double ** | simon_ddt_alloc () |
void | simon_ddt_free (double **T) |
differential_t ** | simon_rsddt_alloc () |
void | simon_rsddt_free (differential_t **T) |
void | simon_ddt_sort_rows (differential_t **T) |
void | simon_ddt_sort (differential_t *SDDT) |
differential_t * | simon_sddt_alloc () |
void | simon_sddt_free (differential_t *ST) |
void | simon_ddt_to_list (double **DDT, differential_t *SDDT) |
void | simon_ddt_to_diff_struct (double **DDT, differential_t **SDDT) |
void | simon_rot_and_ddt (double **D, const uint32_t s, const uint32_t t, const double p_thres) |
void | simon_xor_ddt_search (const int n, const int nrounds, double B[NROUNDS], double *Bn, const differential_t diff_in[NROUNDS], differential_t trail[NROUNDS], const uint32_t dyy_init, uint32_t lrot_const_s, uint32_t lrot_const_t, uint32_t lrot_const_u, differential_t *SDDT, differential_t **RSDDT, double p_thres) |
uint32_t | simon_xor_ddt_trail_search (uint32_t key[SIMON_MAX_NROUNDS], double B[NROUNDS], differential_t trail[NROUNDS], uint32_t num_rounds) |
uint32_t | gen_word_hw_i (const uint32_t k, const uint32_t n, const uint32_t hw, uint32_t *x_in, uint32_t *x_cnt, std::vector< uint32_t > *X) |
uint32_t | gen_word_hw (const uint32_t n, const uint32_t hw, std::vector< uint32_t > *X) |
uint32_t | gen_word_hw_all (const uint32_t word_size, const uint32_t hw) |
void | simon_ddt_add_row (std::unordered_map< uint32_t, std::vector< differential_t >> *T, const uint32_t dx, const uint32_t hw_max) |
void | simon_compute_partial_ddt (std::unordered_map< uint32_t, std::vector< differential_t >> *T, std::vector< uint32_t > DX, const uint32_t hw_max) |
void | simon_compute_full_ddt (std::unordered_map< uint32_t, std::vector< differential_t >> *T) |
void | simon_diff_update_max (const differential_t input_diff, const differential_t output_diff, differential_t *max_diff) |
void | simon_diff_get_max (std::unordered_map< std::string, differential_t * > H, differential_t *max_diff) |
bool | simon_diff_search_oneround (const uint32_t nrounds, std::unordered_map< uint32_t, std::vector< differential_t >> *T, std::unordered_map< uint32_t, differential_t > *H, std::unordered_map< uint32_t, differential_t > *G, const differential_t input_diff, differential_t *max_output_diff, const uint32_t hw_max) |
bool | simon_diff_search_oneround_fast (const uint32_t nrounds, std::unordered_map< uint32_t, std::vector< differential_t >> *T, std::unordered_map< uint32_t, differential_t > *H, std::unordered_map< uint32_t, differential_t > *G, const differential_t input_diff, differential_t *max_output_diff, const uint32_t hw_max, uint64_t *cnt_iter_in) |
void | simon_diff_search (const uint32_t nrounds, const uint32_t dx_in, const uint32_t dy_in, const uint32_t hw_max, std::unordered_map< uint32_t, std::vector< differential_t >> *T, std::unordered_map< uint32_t, differential_t > *D, const uint32_t D_round, const char *logfile) |
void | simon32_ddt_file_write (const char *filename, std::unordered_map< uint32_t, std::vector< differential_t >> *T) |
void | simon32_ddt_file_read (const char *filename, std::unordered_map< uint32_t, std::vector< differential_t >> *T) |
void | simon_gen_args_file_rot_invariant (const char *filename) |
void | simon_gen_args_file (const char *argfile) |
Automatic search for XOR differentials in block cipher Simon32 (16 bit words) using either the full DDT or a complete partial DDT for all differences with max Hamming weight 5.
uint32_t gen_word_hw | ( | const uint32_t | n, |
const uint32_t | hw, | ||
std::vector< uint32_t > * | X | ||
) |
Generate all words of given Hamming weight – wrapper for gen_word_hw_i (recursive version)
uint32_t gen_word_hw_all | ( | const uint32_t | word_size, |
const uint32_t | hw | ||
) |
Generate all words of given Hamming weight Same as gen_word_hw but exhasutively trying out all inputs (non-recursive version)
uint32_t gen_word_hw_i | ( | const uint32_t | k, |
const uint32_t | n, | ||
const uint32_t | hw, | ||
uint32_t * | x_in, | ||
uint32_t * | x_cnt, | ||
std::vector< uint32_t > * | X | ||
) |
Generate all words of given Hamming weight (recursive version)
void simon32_ddt_file_read | ( | const char * | filename, |
std::unordered_map< uint32_t, std::vector< differential_t >> * | T | ||
) |
Read a pre-compute full DDT for Simon32 (16-bit words) from file and store it in a hash table
void simon32_ddt_file_write | ( | const char * | filename, |
std::unordered_map< uint32_t, std::vector< differential_t >> * | T | ||
) |
Pre-compute the full DDT for Simon32 (16-bit words) and store it in file
bool simon_comp_differentials_npairs | ( | differential_t | a, |
differential_t | b | ||
) |
void simon_compute_full_ddt | ( | std::unordered_map< uint32_t, std::vector< differential_t >> * | T | ) |
Compute full DDT T
containing only the non-zero prob. entries
void simon_compute_partial_ddt | ( | std::unordered_map< uint32_t, std::vector< differential_t >> * | T, |
std::vector< uint32_t > | DX, | ||
const uint32_t | hw_max | ||
) |
Compute a partial DDT T
for a subset of inputs stored in X
The subset represent all words of given Hamming weight
void simon_ddt_add_row | ( | std::unordered_map< uint32_t, std::vector< differential_t >> * | T, |
const uint32_t | dx, | ||
const uint32_t | hw_max | ||
) |
Compute one row of a partial DDT T
for a given input dx
double** simon_ddt_alloc | ( | ) |
void simon_ddt_free | ( | double ** | T | ) |
void simon_ddt_sort | ( | differential_t * | SDDT | ) |
void simon_ddt_sort_rows | ( | differential_t ** | T | ) |
void simon_ddt_to_diff_struct | ( | double ** | DDT, |
differential_t ** | SDDT | ||
) |
void simon_ddt_to_list | ( | double ** | DDT, |
differential_t * | SDDT | ||
) |
Convert a DDT to a list of differentials.
bool simon_diff_search_oneround | ( | const uint32_t | nrounds, |
std::unordered_map< uint32_t, std::vector< differential_t >> * | T, | ||
std::unordered_map< uint32_t, differential_t > * | H, | ||
std::unordered_map< uint32_t, differential_t > * | G, | ||
const differential_t | input_diff, | ||
differential_t * | max_output_diff, | ||
const uint32_t | hw_max | ||
) |
Search for differentials for one round (round r
) of Simon
bool simon_diff_search_oneround_fast | ( | const uint32_t | nrounds, |
std::unordered_map< uint32_t, std::vector< differential_t >> * | T, | ||
std::unordered_map< uint32_t, differential_t > * | H, | ||
std::unordered_map< uint32_t, differential_t > * | G, | ||
const differential_t | input_diff, | ||
differential_t * | max_output_diff, | ||
const uint32_t | hw_max, | ||
uint64_t * | cnt_iter_in | ||
) |
Same as simon_diff_search_oneround but without the debugging computations.
void simon_gen_args_file_rot_invariant | ( | const char * | filename | ) |
Generate a list of inputs with a given HW, none of which is a rotated version of another i.e. they are rotation invariant
differential_t** simon_rsddt_alloc | ( | ) |
void simon_rsddt_free | ( | differential_t ** | T | ) |
differential_t* simon_sddt_alloc | ( | ) |
void simon_sddt_free | ( | differential_t * | ST | ) |