]> AND Private Git Repository - Cipher_code.git/blobdiff - OneRoundHash/oneroundhash.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
new
[Cipher_code.git] / OneRoundHash / oneroundhash.cpp
index 063b96fb8fdd768f847e8198972eba11c6d2ea11..8eb527bf2a451851d152aeb3145389219c498550 100644 (file)
@@ -278,32 +278,32 @@ void decrypt_authenticate_algorithm(uchar* seq_in, uchar *seq_out,  int len, uch
       rm2[a]=myrand;
     }  
 
-    for(int a=0;a<h;a+=4) {
+    /*  for(int a=0;a<h;a+=4) {
       X[a]=seq_in[ind2+a];
       X[a+1]=seq_in[ind2+a+1];
       X[a+2]=seq_in[ind2+a+2];
       X[a+3]=seq_in[ind2+a+3];
     }
-
+    */
     for(int a=0;a<h;a+=4) {
-      tmp[a]=Inv_Sbox2[X[a]]^RM2[a];
-      tmp[a+1]=Inv_Sbox2[X[a+1]]^RM2[a+1];
-      tmp[a+2]=Inv_Sbox2[X[a+2]]^RM2[a+2];
-      tmp[a+3]=Inv_Sbox2[X[a+3]]^RM2[a+3];
+      tmp[a]=Inv_Sbox2[seq_in[ind2+a]]^RM2[a];
+      tmp[a+1]=Inv_Sbox2[seq_in[ind2+a+1]]^RM2[a+1];
+      tmp[a+2]=Inv_Sbox2[seq_in[ind2+a+2]]^RM2[a+2];
+      tmp[a+3]=Inv_Sbox2[seq_in[ind2+a+3]]^RM2[a+3];
     }
     
-    for(int a=0;a<h;a+=4) {
+    /*  for(int a=0;a<h;a+=4) {
       X[a]=Inv_Sbox1[tmp[a]]^RM1[a];
       X[a+1]=Inv_Sbox1[tmp[a+1]]^RM1[a+1];
       X[a+2]=Inv_Sbox1[tmp[a+2]]^RM1[a+2];
       X[a+3]=Inv_Sbox1[tmp[a+3]]^RM1[a+3];
-    }
+      }*/
       
     for(int a=0;a<h;a+=4) {
-      seq_out[ind1+a]=X[a];
-      seq_out[ind1+a+1]=X[a+1];
-      seq_out[ind1+a+2]=X[a+2];
-      seq_out[ind1+a+3]=X[a+3];
+      seq_out[ind1+a]=Inv_Sbox1[tmp[a]]^RM1[a];
+      seq_out[ind1+a+1]=Inv_Sbox1[tmp[a+1]]^RM1[a+1];
+      seq_out[ind1+a+2]=Inv_Sbox1[tmp[a+2]]^RM1[a+2];
+      seq_out[ind1+a+3]=Inv_Sbox1[tmp[a+3]]^RM1[a+3];
     }
 
     for(int a=0;a<h;a+=4) {