uchar Sbox1[256];
- uchar Sbox2[256];
+ uchar Sbox2[256];
+ uchar Sbox3[256];
uchar Temp[256];
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++) {
- for(int i=0;i<256;i++) {
- Temp[i]=Sbox1[i];
- }
+
for(int i=0;i<256;i++) {
- Sbox1[i]=Sbox1[Sbox2[i]];
+ Sbox1[i]=Sbox2[Sbox1[i]]; // Sbox1[i]=Sbox1[Sbox2[i]];
}
for(int i=0;i<256;i++) {
- Sbox2[i]=Sbox2[Temp[i]];
+ Sbox2[i]=Sbox3[Sbox2[i]]; // Sbox2[Temp[i]];
}
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;