uchar X[h2];
for(int a=0;a<h2;a++) {
- X[a]=Sbox1[a&0xFF]; //Warning according to the size of h2, we can be outsize of Sbox1[a]
+ X[a]=Sbox1[(a+10*id)&0xFF]; //Warning according to the size of h2, we can be outsize of Sbox1[a]
}
int num=omp_get_max_threads();
cout<<"num "<<num<<endl;
- uchar RM1[num*(h * h)];
- uchar RM2[num*(h * h)];
- prga(sc, num*(h * h), RM1);
- for(int i=0;i<num*h2;i++) {
- RM2[i]=RM1[i];
- }
- uchar keyp[16];
- for (int i = 48; i < 64; i++)
- keyp[i-48] = DK[i];
+
+ uchar RM1[num*(h * h)];
+ uchar RM2[num*(h * h)];
+ /*for(int i=0;i<num;i++) {
+
+ rc4key(&DK[48+i*16], sc, 16);
+ prga(sc, h2, &RM1[h2*i]);
+ for(int a=0;a<h2;a++) {
+ cout<<(int)RM1[h2*i+a]<<" ";
+ }
+ cout<<endl<<endl;
+ }*/
+
+ rc4key(&DK[48], sc, 16);
+ prga(sc, h2*num, RM1);
+
+ rc4key(&DK[64], sc, 16);
+ prga(sc, h2, RM2);
+
+
+
+
+
// cout<<len<<endl;
int *Pbox=new int[len];
int *PboxRM=new int[h2];
- rc4keyperm(keyp, len, rp, Pbox, 16);
+ rc4keyperm(&DK[48+16*num], len, rp, Pbox, 16);
-// printf("len %d\n",len);
- for(int i=0;i<len;i++) {
-// printf("%d \n",Pbox[i]);
- }
-
+ rc4keyperm(RM2, h2, rp, PboxRM, h2);
+ for(int i=0;i<num*h2;i++) {
+ RM2[i]=RM1[i];
+ }
double time=0;
double t=TimeStart();