]> AND Private Git Repository - Cipher_code.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
test
authorRaphaël Couturier <raphael.couturier@univ-fcomte.fr>
Mon, 8 Jul 2019 19:53:09 +0000 (21:53 +0200)
committerRaphaël Couturier <raphael.couturier@univ-fcomte.fr>
Mon, 8 Jul 2019 19:53:09 +0000 (21:53 +0200)
OneRoundIoT/OneRound/one_round_hash_new3.cpp
OneRoundIoT/openssl/openssl_evp_hmac.c

index f7c622d2e90887a402b83fe2940f075bc198919d..b14d8193e2b1a5289b6bf8f23c7b3a72bfb78b93 100644 (file)
@@ -162,15 +162,33 @@ void hash_DSD_BIN(uchar* seq_in, uchar* RM1,int len, int *Pbox,int *PboxRM, ucha
 
 
     // Mix with dynamic RM
 
 
     // Mix with dynamic RM
-    
-    for(int a=0;a<h;a+=4) {
+
+    /*
+     for(int a=0;a<h;a+=4) {
       RM1[a]=Sbox1[RM1[a]^seq_in[ind1+a]]^seq_in[ind2+a];
       RM1[a+1]=Sbox1[RM1[a+1]^seq_in[ind1+a+1]]^seq_in[ind2+a+1];
       RM1[a+2]=Sbox1[RM1[a+2]^seq_in[ind1+a+2]]^seq_in[ind2+a+2];
       RM1[a+3]=Sbox1[RM1[a+3]^seq_in[ind1+a+3]]^seq_in[ind2+a+3];
     }
       RM1[a]=Sbox1[RM1[a]^seq_in[ind1+a]]^seq_in[ind2+a];
       RM1[a+1]=Sbox1[RM1[a+1]^seq_in[ind1+a+1]]^seq_in[ind2+a+1];
       RM1[a+2]=Sbox1[RM1[a+2]^seq_in[ind1+a+2]]^seq_in[ind2+a+2];
       RM1[a+3]=Sbox1[RM1[a+3]^seq_in[ind1+a+3]]^seq_in[ind2+a+3];
     }
+    */
+    
+    for(int a=0;a<h;a+=4) {
+      RM1[a]=RM1[a]^seq_in[ind1+a];
+      RM1[a+1]=RM1[a+1]^seq_in[ind1+a+1];
+      RM1[a+2]=RM1[a+2]^seq_in[ind1+a+2];
+      RM1[a+3]=RM1[a+3]^seq_in[ind1+a+3];
+    }
+
+  for(int a=0;a<h;a+=4) {
+      RM1[a]=Sbox1[RM1[a]]^seq_in[ind2+a];
+      RM1[a+1]=Sbox1[RM1[a+1]]^seq_in[ind2+a+1];
+      RM1[a+2]=Sbox1[RM1[a+2]]^seq_in[ind2+a+2];
+      RM1[a+3]=Sbox1[RM1[a+3]]^seq_in[ind2+a+3];
+    }
 
 
 
 
+    
+
      for(int a=0;a<h;a+=4) {
        RM1[a]=Sbox2[RM1[a]];
        RM1[a+1]=Sbox2[RM1[a+1]];
      for(int a=0;a<h;a+=4) {
        RM1[a]=Sbox2[RM1[a]];
        RM1[a+1]=Sbox2[RM1[a+1]];
index eae5d016638b4c6c151af37d19f89694fbecc83e..59f5f8a06d487c12f5204534787deccc5677e7e6 100644 (file)
@@ -79,6 +79,9 @@ int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key,
   //avant ecb
   if(1 != HMAC_Init_ex(ctx, key, 32, EVP_sha256(), NULL))
     handleErrors();
   //avant ecb
   if(1 != HMAC_Init_ex(ctx, key, 32, EVP_sha256(), NULL))
     handleErrors();
+
+
+  
   // size_t mactlen;
   //unsigned char mact[16] = {0};
 
   // size_t mactlen;
   //unsigned char mact[16] = {0};