X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/4d9a4865f4446306e2815ac4da409c92243b85b2..c1233f272a367c9770d6e352b5018887c14a8c9c:/OneRoundIoT/OneRound/one_round_hash_new.cpp diff --git a/OneRoundIoT/OneRound/one_round_hash_new.cpp b/OneRoundIoT/OneRound/one_round_hash_new.cpp index 03242cd..0bd5788 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--) { - Z[a-1]=Z[a]^Y[a]; + RM1[h-1]=Y[h-1]^Y[0]; + RM1[h-2]=RM1[h-1]^Y[h-1]; + RM1[h-3]=RM1[h-2]^Y[h-2]; + RM1[h-4]=RM1[h-3]^Y[h-3]; + for(int a=h-4;a>0;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]; } - - for(int a=0;a