YAARX: Yet Another ARX Toolkit  0.1
 All Data Structures Files Functions Variables Macros Pages
simon-xor-threshold-search-tests.cc File Reference

Tests for automatic search for XOR differentials in block cipher Simon. 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"
#include "simon-xor-best-trails.hh"

Macros

#define SIMON_DDT_FILE_NAME   "ddt.txt"
 
#define SIMON_LOG_FILE_NAME   "simon.log"
 
#define FULL_DDT   1
 
#define SIMON_TMATRIX_BINARY   1
 

Functions

void test_best_trail_n16 ()
 
void test_simon_xor_ddt_trail_search ()
 
void test_simon_xor_trail_search ()
 
void test_simon_cluster_trails ()
 
void simon_compute_round_diff_matrix (uint32_t word_size, uint32_t lrot_const_s, uint32_t lrot_const_t, uint32_t lrot_const_u, gsl_matrix *A, uint32_t A_nrows, uint32_t A_ncols)
 
void test_simon_compute_round_diff_matrix ()
 
void hash_map_add (std::unordered_map< std::string, differential_t ** > *trails_hash_map)
 
void test_trail_to_string ()
 
void test_simon_verify_differential_gviz ()
 
uint64_t simon_test_code (std::unordered_map< uint32_t, std::vector< differential_t >> *T, std::vector< differential_t > DZ, 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)
 
void test_simon_test_code ()
 
void test_simon_compute_full_ddt ()
 
void test_simon32_ddt_file ()
 
void test_simon_diff_search (const uint32_t dx_in, const uint32_t dy_in, const char *logfile)
 
void test_simon_compute_partial_ddt ()
 
void test_gen_word_hw ()
 
void test_oss_bug ()
 
void test_time ()
 
void test_simon_diff_hash_custom ()
 
void test_simon_trail_hash_custom ()
 
void test_simon_diff_search_fixed ()
 
uint32_t simon_trails_graph_transition_matrix_node_to_index (std::map< simon_diff_graph_node_t, simon_diff_graph_node_t, simon_diff_graph_node_comp > V, const simon_diff_graph_node_t target)
 
void simon_trails_graph_transition_vector_print (gsl_vector *V, uint32_t V_dim)
 
void simon_trails_graph_transition_matrix_print (gsl_matrix *A, uint32_t A_nrows, uint32_t A_ncols)
 
void simon_trails_graph_transition_matrix_binarize (gsl_matrix *A, uint32_t A_nrows, uint32_t A_ncols)
 
void simon_trails_graph_transition_matrix_compute ()
 
void test_simon_trails_graph_transition_matrix ()
 
void test_simon_cluster_trails_datfile_read ()
 
void test_simon_multi_diff_search_fixed ()
 
void simon_best_trails_latex (differential_t trail_1[SIMON_TRAIL_LEN_MAX+1], uint32_t trail_len_1, differential_t trail_2[SIMON_TRAIL_LEN_MAX+1], uint32_t trail_len_2, differential_t trail_3[SIMON_TRAIL_LEN_MAX+1], uint32_t trail_len_3, differential_t trail_4[SIMON_TRAIL_LEN_MAX+1], uint32_t trail_len_4)
 
void test_simon_best_trails_latex ()
 
int main (int argc, char **argv)
 

Variables

uint32_t g_best_trail_n16_len = 11
 
differential_t g_best_trail_n16 [11]
 

Detailed Description

Tests for automatic search for XOR differentials in block cipher Simon.

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

Function Documentation

int main ( int  argc,
char **  argv 
)

Main function.

void simon_trails_graph_transition_matrix_compute ( )

Compute a transition matrix for graph representing the clustering of trails in Simon64 The data for the graph is read from a data file SIMON_CLUSTER_TRAILS_DATFILE written by simon_boost_print_hash_table from a previous call to simon_trail_cluster_search_boost called from test_simon_diff_search_fixed . The data from the file is stored in a vector E of simon_diff_graph_edge_t structures

uint32_t simon_trails_graph_transition_matrix_node_to_index ( std::map< simon_diff_graph_node_t, simon_diff_graph_node_t, simon_diff_graph_node_comp V,
const simon_diff_graph_node_t  target 
)

Given a target node (level,dx,dy) and a vector of such nodes return the index of the target node within the vector or return the size of the vector + 1 if the node was not found.

Used in the computation of the transition matrix of the trails graph for Simon.

Variable Documentation

differential_t g_best_trail_n16[11]
Initial value:
= {
{0xA000, 0x8002, 0, 0.125000},
{0x2200, 0x2800, 0, 0.062500},
{0x2800, 0x8200, 0, 0.125000},
{0x8200, 0x2080, 0, 0.062500},
{0x2080, 0x20, 0, 0.062500},
{ 0x20, 0x0, 0, 0.250000},
{ 0x0, 0x20, 0, 1.000000},
{ 0x20, 0x80, 0, 0.250000},
{ 0x80, 0x220, 0, 0.250000},
{ 0x220, 0x800, 0, 0.062500},
{ 0x800, 0x2220, 0, 0.250000}
}