YAARX: Yet Another ARX Toolkit  0.1
 All Data Structures Files Functions Variables Macros Pages
add-approx.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2014 Luxembourg University,
3  * Laboratory of Algorithmics, Cryptology and Security (LACS).
4  *
5  * This file is part of the YAARX toolkit. YAARX stands for
6  * Yet Another ARX toolkit for analysis of ARX cryptographic algorithms.
7  *
8  * YAARX is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * YAARX is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with YAARX. If not, see <http://www.gnu.org/licenses/>.
20  */
27 #ifndef ADD_APPROX_H
28 #define ADD_APPROX_H
29 
30 // ADD
31 WORD_T add_bitwise(const WORD_T x, const WORD_T y);
32 WORD_T add_approx_o1(const WORD_T x, const WORD_T y);
33 WORD_T add_approx_o2_fast(const WORD_T x, const WORD_T y);
34 WORD_T add_approx_o2(const WORD_T x, const WORD_T y);
35 WORD_T add_approx_o3(const WORD_T x, const WORD_T y);
36 WORD_T add_approx_o4(const WORD_T x, const WORD_T y);
37 WORD_T add_approx_o5(const WORD_T x, const WORD_T y);
38 WORD_T add_approx_o6(const WORD_T x, const WORD_T y);
39 WORD_T add_approx(const WORD_T x, const WORD_T y, const uint32_t order);
40 WORD_T add_approx_any_order(const WORD_T x, const WORD_T y, const uint32_t order);
41 WORD_T add_block_approx(const WORD_T x, const WORD_T y, const uint32_t block_size);
42 // SUB
43 WORD_T sub_bitwise(const WORD_T x, const WORD_T y);
44 WORD_T sub_approx_o1(const WORD_T x, const WORD_T y);
45 WORD_T sub_approx_o2_fast(const WORD_T x, const WORD_T y);
46 WORD_T sub_approx_o2(const WORD_T x, const WORD_T y);
47 WORD_T sub_approx_o3(const WORD_T x, const WORD_T y);
48 WORD_T sub_approx_o4(const WORD_T x, const WORD_T y);
49 WORD_T sub_approx_o5(const WORD_T x, const WORD_T y);
50 WORD_T sub_approx_o6(const WORD_T x, const WORD_T y);
51 WORD_T sub_approx(const WORD_T x, const WORD_T y, const uint32_t order);
52 WORD_T sub_approx_any_order(const WORD_T x, const WORD_T y, const uint32_t order);
53 WORD_T sub_approx_any_order_equiv(const WORD_T x_in, const WORD_T y_in, const uint32_t order_in);
54 // XDP-ADD-APPROX
55 double xdp_add_approx_exper(const WORD_T da, const WORD_T db, const WORD_T dc, uint32_t order);
56 void xdp_add_approx_rec_i(const uint32_t i, const uint32_t order,
57  const WORD_T dx, const WORD_T dy, const WORD_T dz,
58  const WORD_T x, const WORD_T y, uint64_t* cnt_xy);
59 double xdp_add_approx_rec(const WORD_T dx, const WORD_T dy, const WORD_T dz, uint32_t order);
60 double xdp_add_fixed_x_approx_exper(const WORD_T a1, const WORD_T a2, const WORD_T db, const WORD_T dc, uint32_t order);
61 void xdp_add_fixed_x_approx_rec_i(const uint32_t i, const uint32_t order,
62  const WORD_T dy, const WORD_T dz, const WORD_T x, const WORD_T xx,
63  const WORD_T y, uint64_t* cnt_y);
64 double xdp_add_fixed_x_approx_rec(const WORD_T x, const WORD_T xx, const WORD_T dy, const WORD_T dz, uint32_t order);
65 // XDP-SUB-APPROX
66 double xdp_sub_approx_exper(const WORD_T da, const WORD_T db, const WORD_T dc, uint32_t order);
67 void xdp_sub_approx_rec_i(const uint32_t i, const uint32_t order,
68  const WORD_T dx, const WORD_T dy, const WORD_T dz,
69  const WORD_T x, const WORD_T y, uint64_t* cnt_xy);
70 double xdp_sub_approx_rec(const WORD_T dx, const WORD_T dy, const WORD_T dz, uint32_t order);
71 double xdp_sub_fixed_x_approx_exper(const WORD_T a1, const WORD_T a2, const WORD_T db, const WORD_T dc, uint32_t order);
72 void xdp_sub_fixed_x_approx_rec_i(const uint32_t i, const uint32_t order,
73  const WORD_T dy, const WORD_T dz, const WORD_T x, const WORD_T xx,
74  const WORD_T y, uint64_t* cnt_y);
75 double xdp_sub_fixed_x_approx_rec(const WORD_T x, const WORD_T xx, const WORD_T dy, const WORD_T dz, uint32_t order);
76 
77 
78 #endif // #ifndef ADD_APPROX_H
WORD_T sub_approx_any_order_equiv(const WORD_T x_in, const WORD_T y_in, const uint32_t order_in)
Definition: add-approx.cc:884
WORD_T add_block_approx(const WORD_T x, const WORD_T y, const uint32_t block_size)
Definition: add-approx.cc:338
WORD_T sub_bitwise(const WORD_T x, const WORD_T y)
Definition: add-approx.cc:583