From 7b7856e00f598c2da773c47812021d4731993513 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Couturier?= <raphael.couturier@univ-fcomte.fr> Date: Sun, 1 Mar 2020 14:49:07 +0100 Subject: [PATCH] new --- OneRoundIoT/OneRound/rc4_hash3.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/OneRoundIoT/OneRound/rc4_hash3.cpp b/OneRoundIoT/OneRound/rc4_hash3.cpp index 243fc1e..9277f1f 100644 --- a/OneRoundIoT/OneRound/rc4_hash3.cpp +++ b/OneRoundIoT/OneRound/rc4_hash3.cpp @@ -163,34 +163,23 @@ inline static uint64_t splitmix64(uint64_t index) { //the proposed hash function, which is based on DSD structure. Sensitivity is ensured by employing the binary diffusion -void hash_DSD_BIN(uchar* seq_in, uchar* RM1,int len, uchar *S, int h) { +void hash_DSD_BIN(uint64_t * ss, uint64_t* rm,int len,int h) { - // Goal: Calculate the hash value - // Output: RM (hash value) - //uchar X[h]; - //uint64_t rm2[h>>8]; int ind1=0; - uint64_t *rm=(uint64_t*)RM1; - // uint64_t *xx=(uint64_t*)X; - uint64_t *ss=(uint64_t*)seq_in; int a=0; for(int it=0;it<len;it++) { - // Mix with dynamic RM rm[0]=rm[h-1]^ss[ind1]; rm[0]=xorshift64(rm[0] ); for(a=1;a<h;a++) { rm[a]=rm[a-1]^ss[ind1+a]; rm[a]=xorshift64(rm[a]); } - // printf("argh %d\n",a); - //rm[0]=xorshift64(rm[a-1]); - ind1+=h; } @@ -369,10 +358,15 @@ int main(int argc, char** argv) { time=0; + uint64_t *rm=(uint64_t*)RM1; + uint64_t *ss=(uint64_t*)seq; + + + t=TimeStart(); for(int i=0;i<nb_test;i++) { - hash_DSD_BIN(seq, RM1,len,Sbox1,h>>3); + hash_DSD_BIN(ss, rm,len,h>>3); } -- 2.39.5