From: couturie Date: Tue, 17 Apr 2018 05:36:10 +0000 (+0200) Subject: code improvement X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/commitdiff_plain/18a162a51aa2e5a34b4a341c9747ae61e5f4ec4a code improvement --- diff --git a/OneRoundIoT/OneRound/one_round_hash_new.cpp b/OneRoundIoT/OneRound/one_round_hash_new.cpp index 03242cd..84e1ee6 100644 --- a/OneRoundIoT/OneRound/one_round_hash_new.cpp +++ b/OneRoundIoT/OneRound/one_round_hash_new.cpp @@ -171,8 +171,14 @@ void hash_DSD_BIN(uchar* seq_in, uchar* RM1,int len, int *PboxRM, uchar *Sbox1, Y[0]=X[0]^X[h-1]; - for(int a=1;a0;a-=4) { + RM1[a-1]=RM1[a]^Y[a]; + RM1[a-2]=RM1[a-1]^Y[a-1]; + RM1[a-3]=RM1[a-2]^Y[a-2]; + RM1[a-4]=RM1[a-3]^Y[a-3]; + } + + // Z[h-1]=Y[h-1]^Y[0]; + // Z[h-2]=Z[h-1]^Y[h-1]; + // for(int a=h-2;a>0;a-=2) { + // Z[a-1]=Z[a]^Y[a]; + // Z[a-2]=Z[a-1]^Y[a-1]; + // } - Z[h-1]=Y[h-1]^Y[0]; - for(int a=h-1;a>0;a--) { - Z[a-1]=Z[a]^Y[a]; - } - + // /* + // Z[h-1]=Y[h-1]^Y[0]; + // Z[h-2]=Z[h-1]^Y[h-1]; + // Z[h-3]=Z[h-2]^Y[h-2]; + // Z[h-4]=Z[h-3]^Y[h-3]; + // for(int a=h-4;a>0;a-=4) { + // Z[a-1]=Z[a]^Y[a]; + // Z[a]=Z[a+1]^Y[a+1]; + // Z[a+1]=Z[a+2]^Y[a+2]; + // Z[a+2]=Z[a+3]^Y[a+3]; + // } + // */ - for(int a=0;a