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

Differential Cryptanalysis of block cipher RC5 . More...

#include "common.hh"
#include "xdp-add.hh"
#include "xdp-add-diff-set.hh"
#include "rc5-ref.hh"
#include "rc5-eq.hh"
#include "rc5-dc.hh"
#include "rc5-alex.hh"
#include "add-approx.hh"

Functions

void rc5_key_vec_print (const std::vector< rc5_key_t > key_vec, const WORD_T key_correct, const uint32_t ntop)
 
void rc5_key_set_print (const std::set< rc5_key_t, rc5_compare_key_by_value > key_set, WORD_T key_correct)
 
bool rc5_struct_key_compare_by_counter (rc5_key_t first, rc5_key_t second)
 
bool rc5_struct_key_compare_by_value (rc5_key_t first, rc5_key_t second)
 
uint32_t rc5_key_set_update (const WORD_T new_key_value, std::set< rc5_key_t, rc5_compare_key_by_value > *key_set)
 
bool rc5_pairs_compare_by_ciphertext_diff_hw (const pair_t pair_one, const pair_t pair_two)
 
void rc5_filtered_pairs_sort_by_ciphertext_diff_hw (std::vector< pair_t > *pair_vec)
 
void rc5_filtered_pairs_read_from_file (const char *filename, uint32_t k[16], WORD_T *rand_L, WORD_T *rand_R, std::vector< pair_t > *pair_vec, std::vector< bool > *b_pair_is_good_vec)
 
void rc5_log_file_read ()
 
void rc5_compute_structures (std::vector< std::pair< WORD_T, WORD_T >> *P, const uint32_t word_size, const WORD_T k, const WORD_T lsb_start_idx)
 

Variables

const uint32_t g_key [16] = {0xbb, 0x7d, 0x3c, 0x0c, 0xad, 0xed, 0x70, 0x25, 0x8e, 0x19, 0xe4, 0x28, 0x98, 0x57, 0x10, 0xa7}
 
uint32_t g_arr_len = ((2*NROUNDS) + 3)
 
double g_min_prob_arr [(2 *NROUNDS)+3]
 
double g_max_hw_arr [(2 *NROUNDS)+3]
 
uint32_t g_add_approx_arr [(2 *NROUNDS)+3][WORD_SIZE]
 
char g_filename [RC5_FILENAME_LEN]
 
char g_rc5_filtered_pairs_filename [RC5_FILENAME_LEN]
 

Detailed Description

Differential Cryptanalysis of block cipher RC5 .

Author
V.Velichkov, vesse.nosp@m.lin..nosp@m.velic.nosp@m.hkov.nosp@m.@uni..nosp@m.lu

Function Documentation

void rc5_compute_structures ( std::vector< std::pair< WORD_T, WORD_T >> *  P,
const uint32_t  word_size,
const WORD_T  k,
const WORD_T  lsb_start_idx 
)

Compute structures of plaintexts

Parameters
Parray of pairs of plaintexts. Each pair satisfies one of k 1-bit differences
knumber of linearly indepedent 1 bit differences delta_i (see [Biryukov, Kushilevitz])
lsb_start_idxfirst LSB bit index from which the constrcution of the delta-s begins
void rc5_filtered_pairs_read_from_file ( const char *  filename,
uint32_t  k[16],
WORD_T *  rand_L,
WORD_T *  rand_R,
std::vector< pair_t > *  pair_vec,
std::vector< bool > *  b_pair_is_good_vec 
)
void rc5_filtered_pairs_sort_by_ciphertext_diff_hw ( std::vector< pair_t > *  pair_vec)

Sort the list of pairs by the (sum of) Hamming weights of the difference of the ciphertexts.

uint32_t rc5_key_set_update ( const WORD_T  new_key_value,
std::set< rc5_key_t, rc5_compare_key_by_value > *  key_set 
)

If the key is new - add it to the set, otherwise update its counter.

void rc5_key_vec_print ( const std::vector< rc5_key_t key_vec,
const WORD_T  key_correct,
const uint32_t  ntop 
)

Prinst the top ntop key candidates

void rc5_log_file_read ( )