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

Analysis of block cipher Simon [ePrint 2013/404]. More...

#include "common.hh"
#include "xdp-rot-and.hh"
#include "simon.hh"

Functions

uint32_t simon_compute_nkeywords (uint32_t word_size, uint32_t key_size)
 
uint32_t simon_get_keysize (uint32_t word_size)
 
uint32_t simon_compute_nrounds (uint32_t word_size, uint32_t nkey_words, uint32_t *zseq_j)
 
void simon_key_expansion (uint32_t key[SIMON_MAX_NROUNDS], uint32_t Z[5][62], uint32_t zseq_j, uint32_t nrounds, uint32_t nkey_words)
 
void simon_encrypt (uint32_t key[SIMON_MAX_NROUNDS], uint32_t nrounds, uint32_t *x_in, uint32_t *y_in)
 
void simon_diff_graph_check_edge (std::vector< simon_diff_graph_edge_t > *E, const simon_diff_graph_edge_t new_edge)
 
void simon_encrypt_pairs (uint32_t key[SIMON_MAX_NROUNDS], uint32_t nrounds, uint32_t *x_in, uint32_t *y_in, uint32_t *xx_in, uint32_t *yy_in, std::vector< simon_diff_graph_edge_t > *E)
 

Variables

uint32_t g_simon_zseq [5][62]
 

Detailed Description

Analysis of block cipher Simon [ePrint 2013/404].

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

Function Documentation

uint32_t simon_compute_nkeywords ( uint32_t  word_size,
uint32_t  key_size 
)

Compute the number of key words depending on the word size

Parameters
word_sizeword size
key_sizekey size in bits
uint32_t simon_compute_nrounds ( uint32_t  word_size,
uint32_t  nkey_words,
uint32_t *  zseq_j 
)

Compute the number of rounds for Simon and the index of the z-sequence

Parameters
word_sizeword size
nkey_wordsnumber of key words
zseq_jindex of the z-sequence g_simon_zseq
Returns
number of rounds
void simon_encrypt ( uint32_t  key[SIMON_MAX_NROUNDS],
uint32_t  nrounds,
uint32_t *  x_in,
uint32_t *  y_in 
)

Simon encryption procedure.

Parameters
keyexpanded key
nroundsnumber of rounds
x_infirst plaintext word
y_insecond plaintext word
uint32_t simon_get_keysize ( uint32_t  word_size)

Get the size of the key in bits depending on the word size

Parameters
word_sizeword size in bits
void simon_key_expansion ( uint32_t  key[SIMON_MAX_NROUNDS],
uint32_t  Z[5][62],
uint32_t  zseq_j,
uint32_t  nrounds,
uint32_t  nkey_words 
)

Simon key expansion procedure.

Parameters
keyoriginal key (with enough space for the expanded key)
Zthe z-sequence ( g_simon_zseq)
zseq_jindex of the z-seqence
nroundsnumber of rounds
nkey_wordsnumber of key words

Variable Documentation

uint32_t g_simon_zseq[5][62]
Initial value:
= {
{1,1,1,1,1,0,1,0,0,0,1,0,0,1,0,1,0,1,1,0,0,0,0,1,1,1,0,0,1,1,0,
1,1,1,1,1,0,1,0,0,0,1,0,0,1,0,1,0,1,1,0,0,0,0,1,1,1,0,0,1,1,0},
{1,0,0,0,1,1,1,0,1,1,1,1,1,0,0,1,0,0,1,1,0,0,0,0,1,0,1,1,0,1,0,
1,0,0,0,1,1,1,0,1,1,1,1,1,0,0,1,0,0,1,1,0,0,0,0,1,0,1,1,0,1,0},
{1,0,1,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,0,0,
0,1,0,1,0,0,0,0,1,0,0,0,1,1,1,1,1,1,0,0,1,0,1,1,0,1,1,0,0,1,1},
{1,1,0,1,1,0,1,1,1,0,1,0,1,1,0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,0,0,
0,0,1,0,0,1,0,0,0,1,0,1,0,0,1,1,1,0,0,1,1,0,1,0,0,0,0,1,1,1,1},
{1,1,0,1,0,0,0,1,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,0,0,0,1,0,0,0,0,
0,0,1,0,1,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,0,1,1,1,0,1,1,1,1}
}

Pre-computed z_j sequences (o <= j < 5) used in the key schedule of Simon.