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

Header file for speck.cc: Analysis of block cipher Speck [ePrint 2013/404]. . More...

Go to the source code of this file.

Data Structures

struct  speck_diff_equal_to
 
struct  speck_diff_hash
 
struct  speck_trail_equal_to
 
struct  speck_trail_hash
 

Macros

#define SPECK_MAX_NKEY_WORDS   4
 
#define SPECK_KEY_LEN_BITS   128
 
#define SPECK_MAX_NROUNDS   34
 
#define SPECK_RIGHT_ROT_CONST   8
 
#define SPECK_LEFT_ROT_CONST   3
 
#define SPECK_RIGHT_ROT_CONST_16BITS   7
 
#define SPECK_LEFT_ROT_CONST_16BITS   2
 
#define SPECK_P_THRES   (1.0 / (double)(1UL << 16))
 
#define SPECK_MAX_DIFF_CNT   (1ULL << 22)
 
#define SPECK_NPAIRS   (1ULL << 24)
 
#define SPECK_BEST_TRAIL_LOG2P   -58
 
#define SPECK_MAX_HW   16
 
#define SPECK_CLUSTER_MAX_HW   9
 
#define SPECK_BACK_TO_HWAY   0
 
#define SPECK_GREEDY_SEARCH   0
 
#define SPECK_NDIFFS   2
 
#define SPECK_EPS   (double)(1.0 / (double)(1ULL << 15))
 
#define SPECK_DEBUG   0
 
#define SPECK_TRAIL_LEN_MAX   14
 
#define SPECK_BEST_TRAILS_LATEX_FILE   "speck-trails.tex"
 
#define SPECK_48   0
 
#define SPECK_P_THRES   (1.0 / (double)(1UL << 5))
 
#define SPECK_USE_PRECOMPUTED_BOUNDS   0
 
#define SPECK_TRAIL_LEN   20
 
#define SPECK_LOG_FILE   "speck.log"
 

Functions

uint32_t speck_compute_nkeywords (uint32_t word_size, uint32_t key_size)
 
uint32_t speck_get_keysize (uint32_t word_size)
 
void speck_get_rot_const (uint32_t word_size, uint32_t *alpha, uint32_t *beta)
 
uint32_t speck_compute_nrounds (uint32_t word_size, uint32_t nkey_words)
 
void speck_key_expansion (WORD_T key[SPECK_MAX_NROUNDS], uint32_t nrounds, uint32_t nkey_words, uint32_t alpha, uint32_t beta)
 
void speck_encrypt (WORD_T key[SPECK_MAX_NROUNDS], uint32_t nrounds, uint32_t alpha, uint32_t beta, WORD_T *x_in, WORD_T *y_in)
 
void speck_decrypt (WORD_T key[SPECK_MAX_NROUNDS], uint32_t nrounds, uint32_t alpha, uint32_t beta, WORD_T *x_in, WORD_T *y_in)
 

Detailed Description

Header file for speck.cc: Analysis of block cipher Speck [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 speck_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 speck_compute_nrounds ( uint32_t  word_size,
uint32_t  nkey_words 
)

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

Parameters
word_sizeword size
nkey_wordsnumber of key words
Returns
number of rounds
void speck_encrypt ( WORD_T  key[SPECK_MAX_NROUNDS],
uint32_t  nrounds,
uint32_t  alpha,
uint32_t  beta,
WORD_T *  x_in,
WORD_T *  y_in 
)

Speck encryption procedure.

Parameters
keyexpanded key
nroundsnumber of rounds
alpharight rotation constant
betaleft rotation constant
x_infirst plaintext word
y_insecond plaintext word
uint32_t speck_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 speck_get_rot_const ( uint32_t  word_size,
uint32_t *  alpha,
uint32_t *  beta 
)

Get the rotation constants.

void speck_key_expansion ( WORD_T  key[SPECK_MAX_NROUNDS],
uint32_t  nrounds,
uint32_t  nkey_words,
uint32_t  alpha,
uint32_t  beta 
)

Speck key expansion procedure.

Parameters
keyoriginal key (with enough space for the expanded key)
nroundsnumber of rounds
nkey_wordsnumber of key words
alpharight rotation constant
betaleft rotation constant