X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/7b02553c06f361be8c2f181d0a6cb4cd6b4fdb39..d4f8c336045ad5a298df62e30d6c463ff1f1b5b7:/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 a76f70a..0bd5788 100644 --- a/OneRoundIoT/OneRound/one_round_hash_new.cpp +++ b/OneRoundIoT/OneRound/one_round_hash_new.cpp @@ -135,7 +135,7 @@ void prga(uchar *sc, int ldata, uchar *r) { } } - +inline uchar circ(uchar x,int n) {return (x << n) | (x >> (8 - n));} //the proposed hash function, which is based on DSD structure. Sensitivity is ensured by employing the binary diffusion @@ -168,51 +168,41 @@ void hash_DSD_BIN(uchar* seq_in, uchar* RM1,int len, int *PboxRM, uchar *Sbox1, X[a+3]=RM1[a+3]^seq_in[ind2+a+3]; } -/* Y[0]=Sbox1[X[0]^X[h-1]]; - for(int a=1;a0;a--) { - Z[a-1]=Sbox2[Z[a]^Y[a]]; - } -*/ Y[0]=X[0]^X[h-1]; - for(int a=1;a0;a--) { - Z[a-1]=Z[a]^Y[a]; - } + - for(int a=0;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]; } + - for(int a=0;a