X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/b73a702c2148fa89e07f8035a652997cf156c36b..1675b71b9488fd8b62558d9af2e30b4f9d150849:/OneRoundIoT/OneRound/rc4_hash2.cpp diff --git a/OneRoundIoT/OneRound/rc4_hash2.cpp b/OneRoundIoT/OneRound/rc4_hash2.cpp index 89790e4..386ddf7 100644 --- a/OneRoundIoT/OneRound/rc4_hash2.cpp +++ b/OneRoundIoT/OneRound/rc4_hash2.cpp @@ -168,38 +168,26 @@ 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; uint64_t *rm=(uint64_t*)RM1; - uint64_t *xx=(uint64_t*)X; + // uint64_t *xx=(uint64_t*)X; uint64_t *ss=(uint64_t*)seq_in; for(int it=0;it>3; // Mix with dynamic RM uint64_t sum=0; - /* for(int a=0;a>3);a++) { - xx[a]=rm[a]^ss[ind1+a]; - sum+=xx[a]; + rm[a]=rm[a]^ss[ind1+a]; + sum^=rm[a]; } @@ -207,7 +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]=xorshift64(rm[a-1]); + //rm[a]=splitmix64(rm[a-1]); } @@ -309,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]);