X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/54769a8ee0ec8e6038b44fdbf9656585e7d3e31c..1675b71b9488fd8b62558d9af2e30b4f9d150849:/OneRoundIoT/OneRound/rc4_hash2.cpp?ds=sidebyside diff --git a/OneRoundIoT/OneRound/rc4_hash2.cpp b/OneRoundIoT/OneRound/rc4_hash2.cpp index 10f9823..386ddf7 100644 --- a/OneRoundIoT/OneRound/rc4_hash2.cpp +++ b/OneRoundIoT/OneRound/rc4_hash2.cpp @@ -168,9 +168,6 @@ void hash_DSD_BIN(uchar* seq_in, uchar* RM1,int len, uchar *S, int h) { // Goal: Calculate the hash value // Output: RM (hash value) - -// uchar *X=new uchar[h2]; -// uchar *fX=new uchar[h2]; uchar X[h]; int ind1,ind2; @@ -182,8 +179,6 @@ void hash_DSD_BIN(uchar* seq_in, uchar* RM1,int len, uchar *S, int h) { for(int it=0;it>3; // Mix with dynamic RM @@ -192,7 +187,7 @@ void hash_DSD_BIN(uchar* seq_in, uchar* RM1,int len, uchar *S, int h) { for(int a=0;a<(h>>3);a++) { rm[a]=rm[a]^ss[ind1+a]; - sum+=rm[a]; + sum^=rm[a]; } @@ -200,8 +195,8 @@ void hash_DSD_BIN(uchar* seq_in, uchar* RM1,int len, uchar *S, int h) { rm[0]=xorshift64(sum); for(int a=1;a<(h>>3);a++) { - rm[a]^=xorshift64(rm[a-1]); - //rm[a]^=splitmix64(rm[a-1]); + rm[a]=xorshift64(rm[a-1]); + //rm[a]=splitmix64(rm[a-1]); } @@ -303,10 +298,12 @@ int main(int argc, char** argv) { if(change==1) { seq[4]++; + seq[5]--; } if(change==2) { seq[9]++; + seq[10]--; } printf("seq 4 %d\n",seq[4]);