A
lgorithmique
N
umérique
D
istribuée
Private GIT Repository
projects
/
Cipher_code.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new
[Cipher_code.git]
/
OneRoundIoT
/
EnhancedOneRound
/
test_substitution.cpp
diff --git
a/OneRoundIoT/EnhancedOneRound/test_substitution.cpp
b/OneRoundIoT/EnhancedOneRound/test_substitution.cpp
index 48ea63f10245ffdfe8b15e3db7a161188cf14f9c..978876bc0a9bf11e6174d8b8b6835521eb5a7d81 100644
(file)
--- a/
OneRoundIoT/EnhancedOneRound/test_substitution.cpp
+++ b/
OneRoundIoT/EnhancedOneRound/test_substitution.cpp
@@
-206,7
+206,8
@@
int main(int argc, char** argv) {
uchar Sbox1[256];
uchar Sbox1[256];
- uchar Sbox2[256];
+ uchar Sbox2[256];
+ uchar Sbox3[256];
uchar Temp[256];
uchar Temp[256];
@@
-214,27
+215,36
@@
int main(int argc, char** argv) {
double time=0;
double time=0;
- rc4key(DK, Sbox1,
8
);
+ rc4key(DK, Sbox1,
16
);
- rc4key(&DK[
8], Sbox2, 8
);
+ rc4key(&DK[
16], Sbox2, 16
);
+ rc4key(&DK[32], Sbox3, 16);
+
+
+ for(int i=0;i<256;i++)
+ cout<<(int)Sbox1[i]<<" ";
+ cout<<endl;
+
+ for(int i=0;i<256;i++)
+ cout<<(int)Sbox2[i]<<" ";
+ cout<<endl;
+
double t=TimeStart();
for(int nb=0;nb<nb_test;nb++) {
double t=TimeStart();
for(int nb=0;nb<nb_test;nb++) {
- for(int i=0;i<256;i++) {
- Temp[i]=Sbox1[i];
- }
+
for(int i=0;i<256;i++) {
for(int i=0;i<256;i++) {
- Sbox1[i]=Sbox1[Sbox2[i]];
+ Sbox1[i]=Sbox
2[Sbox1[i]]; // Sbox1[i]=Sbox
1[Sbox2[i]];
}
for(int i=0;i<256;i++) {
}
for(int i=0;i<256;i++) {
- Sbox2[i]=Sbox
2[Temp[i]];
+ Sbox2[i]=Sbox
3[Sbox2[i]]; // Sbox2[Temp[i]];
}
}
@@
-243,6
+253,9
@@
int main(int argc, char** argv) {
time+=TimeStop(t);
cout<<"Time sub nb times "<<nb_test<<" = "<<time<<endl;
time+=TimeStop(t);
cout<<"Time sub nb times "<<nb_test<<" = "<<time<<endl;
+ for(int i=0;i<256;i++)
+ cout<<(int)Sbox1[i]<<" ";
+ cout<<endl;
return 0;
return 0;