-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.cpp
183 lines (124 loc) · 4.06 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
main() funcion for speed comparison of block ciphers optimized software implementation
- printing test vectors of all ciphers;
- measuring running time for encryption and printing encryption speed of all ciphers
Author: Roman Oliynykov
*/
#include <iostream>
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using std::hex;
using std::ios_base;
#include "time_measure.hpp"
#include "Kalyna/k2_128_128.hpp"
#include "Kalyna/k2_128_256.hpp"
#include "Kalyna/k2_256_256.hpp"
#include "Kalyna/k2_256_512.hpp"
#include "Kalyna/k2_512_512.hpp"
#include "aes/aes.hpp"
#include "gost/gost.hpp"
#include "Belt/Belt.hpp"
#include "kuznyechik/kuznyechik.hpp"
int main()
{
struct timeval start_ticks, finish_ticks;
print_k2_128_128_test();
print_k2_128_256_test();
print_k2_256_256_test();
print_k2_256_512_test();
print_k2_512_512_test();
print_aes_test();
print_gost_test();
print_BelT_test();
print_kuzn_test();
cout << endl << "Encryption speed test results:" << endl << endl;
/// K-128-128
InitMemoryEncryptionBlock();
DetermineTime( start_ticks );
Test_K2_128_128_Speed_Expanded_Memory();
DetermineTime( finish_ticks );
cout.width( 28 );
cout << " Kalyna-128/128 : " << CalculateEncryptionSpeedMemory( start_ticks, finish_ticks ) \
<< " Mb/s" << endl << endl;
/// K-128-256
InitMemoryEncryptionBlock();
DetermineTime( start_ticks );
Test_K2_128_256_Speed_Expanded_Memory();
DetermineTime( finish_ticks );
cout.width( 28 );
cout << " Kalyna-128/256 : " << CalculateEncryptionSpeedMemory( start_ticks, finish_ticks ) \
<< " Mb/s" << endl << endl;
/// K-256-256
InitMemoryEncryptionBlock();
DetermineTime(start_ticks);
Test_K2_256_256_Speed_Expanded_Memory();
DetermineTime(finish_ticks);
cout.width( 28 );
cout << " Kalyna-256/256 : "
<< CalculateEncryptionSpeedMemory(start_ticks, finish_ticks)
<< " Mb/s" << endl << endl;
/// K-256-512
InitMemoryEncryptionBlock();
DetermineTime(start_ticks);
Test_K2_256_512_Speed_Expanded_Memory();
DetermineTime(finish_ticks);
cout.width( 28 );
cout << " Kalyna-256/512 : "
<< CalculateEncryptionSpeedMemory(start_ticks, finish_ticks)
<< " Mb/s" << endl << endl;
/// K-512-512
InitMemoryEncryptionBlock();
DetermineTime(start_ticks);
Test_K2_512_512_Speed_Expanded_Memory();
DetermineTime(finish_ticks);
cout.width( 28 );
cout << " Kalyna-512/512 : "
<< CalculateEncryptionSpeedMemory(start_ticks, finish_ticks)
<< " Mb/s" << endl << endl;
/// AES-128-128
InitMemoryEncryptionBlock();
DetermineTime( start_ticks );
Test_AES_128_128_Speed_Expanded_Memory();
DetermineTime( finish_ticks );
cout.width( 28 );
cout << " AES-128 : " << CalculateEncryptionSpeedMemory( start_ticks, finish_ticks ) \
<< " Mb/s" << endl << endl;
/// AES-128-256
InitMemoryEncryptionBlock();
DetermineTime(start_ticks);
Test_AES_128_256_Speed_Expanded_Memory();
DetermineTime(finish_ticks);
cout.width( 28 );
cout << " AES-256 : "
<< CalculateEncryptionSpeedMemory(start_ticks, finish_ticks)
<< " Mb/s" << endl << endl;
/// GOST 28147-89
InitMemoryEncryptionBlock();
DetermineTime(start_ticks);
Test_GOST_Speed_Expanded_Memory();
DetermineTime(finish_ticks);
cout.width( 28 );
cout << " GOST 28147-89 : "
<< CalculateEncryptionSpeedMemory(start_ticks, finish_ticks)
<< " Mb/s" << endl << endl;
/// BelT
InitMemoryEncryptionBlock();
DetermineTime( start_ticks );
Test_BelT_Speed_Expanded_Memory();
DetermineTime( finish_ticks );
cout.width( 28 );
cout << " STB 34.101.31-2011(BelT) : "
<< CalculateEncryptionSpeedMemory( start_ticks, finish_ticks ) \
<< " Mb/s" << endl << endl;
/// Kuznyechik
InitMemoryEncryptionBlock();
DetermineTime( start_ticks );
Test_kuzn_Speed_Expanded_Memory();
DetermineTime( finish_ticks );
cout.width( 28 );
cout << " Kuznyechik : " << CalculateEncryptionSpeedMemory( start_ticks, finish_ticks ) \
<< " Mb/s" << endl << endl;
return 0;
}