uchar X[h2];
- for(int a=0;a<h2;a++) {
- X[a]=Sbox1[(a+10*id)&0xFF]; //Warning according to the size of h2, we can be outsize of Sbox1[a]
- }
+ for(int a=0;a<h2;a+=4) {
+ X[a]=Sbox1[a&0xFF]; //Warning according to the size of h2, we can be outsize of Sbox1[a]
+ X[a+1]=Sbox1[(a+1)&0xFF];
+ X[a+2]=Sbox1[(a+2)&0xFF];
+ X[a+3]=Sbox1[(a+3)&0xFF];
+ }
int offset=p*loc_len;
X[a+3]=X[Sbox1[a+3]];
}
- for(int a=0;a<h2;a+=4){
- fX[a]=X[a];
- fX[a+1]=X[a+1];
- fX[a+2]=X[a+2];
- fX[a+3]=X[a+3];
- }
-
-
-
-
+
+ for(int a=0;a<h2;a+=4) {
+ fX[a]=X[a]^RM2[a];
+ fX[a+1]=X[a+1]^RM2[a+1];
+ fX[a+2]=X[a+2]^RM2[a+2];
+ fX[a+3]=X[a+3]^RM2[a+3];
+ }
- for(int a=0;a<h2;a+=4) {
+ /*for(int a=0;a<h2;a+=4) {
fX[a]=Sbox2[fX[a]];
fX[a+1]=Sbox2[fX[a+1]];
fX[a+2]=Sbox2[fX[a+2]];
fX[a+3]=Sbox2[fX[a+3]];
- }
+ }*/
// rotate(RM1, &RM2[id*h2], h2, Pbox[it]%h2);
- for(int a=0;a<h2;a+=4) {
- RM2[a]=RM2[PboxRM[a]];
- RM2[a+1]=RM2[PboxRM[a+1]];
- RM2[a+2]=RM2[PboxRM[a+2]];
- RM2[a+3]=RM2[PboxRM[a+3]];
- }
- for(int a=0;a<h2;a+=4) {
- fX[a]=fX[a]^RM2[a];
- fX[a+1]=fX[a+1]^RM2[a+1];
- fX[a+2]=fX[a+2]^RM2[a+2];
- fX[a+3]=fX[a+3]^RM2[a+3];
- }
+
+
seq_out[ind1+a+2]=fX[a+2];
seq_out[ind1+a+3]=fX[a+3];
}
-
+
+
+
+ for(int a=0;a<h2;a+=4) {
+ RM2[a]=RM2[PboxRM[a]];
+ RM2[a+1]=RM2[PboxRM[a+1]];
+ RM2[a+2]=RM2[PboxRM[a+2]];
+ RM2[a+3]=RM2[PboxRM[a+3]];
+ }
+
+
/*for(int a=0;a<h2;a+=4) {
RM1[id*h2+a]=RM1[id*h2+PboxRM[a]];
RM1[id*h2+a+1]=RM1[id*h2+PboxRM[a+1]];