uchar *RM2;
uchar tmp[h];
+
+ int gg=(Sbox1[12]&(h-1))*(Sbox2[32]&(h-1));
+
for(int a=0;a<h;a+=4) {
- IV1[a]=RM[h+a];
- IV1[a+1]=RM[h+a+1];
- IV1[a+2]=RM[h+a+2];
- IV1[a+3]=RM[h+a+3];
+ IV1[a]=RM[gg+a];
+ IV1[a+1]=RM[gg+a+1];
+ IV1[a+2]=RM[gg+a+2];
+ IV1[a+3]=RM[gg+a+3];
}
+ gg=gg=(Sbox1[102]&(h-1))*(Sbox2[72]&(h-1));
+
for(int a=0;a<h;a+=4) {
- IV2[a]=RM[h*h+a];
- IV2[a+1]=RM[h*h+a+1];
- IV2[a+2]=RM[h*h+a+2];
- IV2[a+3]=RM[h*h+a+3];
+ IV2[a]=RM[gg+a];
+ IV2[a+1]=RM[gg+a+1];
+ IV2[a+2]=RM[gg+a+2];
+ IV2[a+3]=RM[gg+a+3];
}
-
-
for(int it=0;it<len/2;it++) {
int ind1=Pbox[it]*h;
int ind2=Pbox[it+len/2]*h;
-
- RM1=&RM[PboxSRM[it]*h];
- RM2=&RM[h*h+PboxSRM[it]*h];
-
+ RM1=&RM[PboxSRM[it]*h+Sbox1[it&255]];
+ RM2=&RM[PboxSRM[len/2-it]*h+Sbox2[it&255]];
+
for(int a=0;a<h;a+=4) {
X[a]=seq_in[ind2+a];
X[a+1]=seq_in[ind2+a+1];
uchar *RM2;
uchar tmp[h];
- for(int a=0;a<h;a+=4) {
- IV1[a]=RM[h+a];
- IV1[a+1]=RM[h+a+1];
- IV1[a+2]=RM[h+a+2];
- IV1[a+3]=RM[h+a+3];
+ int gg=(Sbox1[12]&(h-1))*(Sbox2[32]&(h-1));
+
+ for(int a=0;a<h;a+=4) {
+ IV1[a]=RM[gg+a];
+ IV1[a+1]=RM[gg+a+1];
+ IV1[a+2]=RM[gg+a+2];
+ IV1[a+3]=RM[gg+a+3];
}
+ gg=gg=(Sbox1[102]&(h-1))*(Sbox2[72]&(h-1));
+
for(int a=0;a<h;a+=4) {
- IV2[a]=RM[h*h+a];
- IV2[a+1]=RM[h*h+a+1];
- IV2[a+2]=RM[h*h+a+2];
- IV2[a+3]=RM[h*h+a+3];
+ IV2[a]=RM[gg+a];
+ IV2[a+1]=RM[gg+a+1];
+ IV2[a+2]=RM[gg+a+2];
+ IV2[a+3]=RM[gg+a+3];
}
-
for(int it=0;it<len/2;it++) {
int ind1=Pbox[it]*h;
int ind2=Pbox[it+len/2]*h;
- RM1=&RM[PboxSRM[it]*h];
- RM2=&RM[h*h+PboxSRM[it]*h];
-
+ RM1=&RM[PboxSRM[it]*h+Sbox1[it&255]];
+ RM2=&RM[PboxSRM[len/2-it]*h+Sbox2[it&255]];
+
+
for(int a=0;a<h;a+=4) {
printf("lena %d\n",lena);
printf("size_buf %d\n",size_buf);
- int h2=h*h;
uchar Sbox2[256];
uchar Inv_Sbox1[256];
uchar Inv_Sbox2[256];
- uchar sc[h2*2];
- uchar RM[h2*2];
+ uchar sc[256];
+ uchar RM[h*h+256];
ulong myrand=0;
rc4key(&DK[8], Sbox2, 8);
rc4key(&DK[16], sc, 16);
- prga(sc, h2*2, RM);
+ prga(sc, h*h+256, RM);