From 50aed0e4bc4897c2ccad084a80e1cac8bfe088e3 Mon Sep 17 00:00:00 2001 From: couturie Date: Tue, 17 Apr 2018 11:41:58 +0200 Subject: [PATCH 1/1] last improvement --- OneRoundIoT/OneRound/one_round_auth.cpp | 141 ++++++++++-------------- 1 file changed, 56 insertions(+), 85 deletions(-) diff --git a/OneRoundIoT/OneRound/one_round_auth.cpp b/OneRoundIoT/OneRound/one_round_auth.cpp index c47f546..9c137ed 100644 --- a/OneRoundIoT/OneRound/one_round_auth.cpp +++ b/OneRoundIoT/OneRound/one_round_auth.cpp @@ -133,6 +133,55 @@ void prga(uchar *sc, int ldata, uchar *r) { } +template +void myhash(uchar *X, uchar* RM2, uchar *Sbox2) { + uchar Y[h]; + uchar X2[h]; + + for(int k=0;k0;a-=4) { + RM2[a-1]=RM2[a]^Y[a]; + RM2[a-2]=RM2[a-1]^Y[a-1]; + RM2[a-3]=RM2[a-2]^Y[a-2]; + RM2[a-4]=RM2[a-3]^Y[a-3]; + } + } +} template @@ -191,48 +240,7 @@ void encrypt_ctr(uchar* seq_in, uchar *seq_out, int len,uchar* RM1,uchar *RM2,in } if(!enc) { - - for(int k=0;k0;a--) { - Z[a-1]=Z[a]^Y[a]; - } - - - for(int a=0;a(&seq_in[ind2], RM2, Sbox2); } @@ -248,47 +256,7 @@ void encrypt_ctr(uchar* seq_in, uchar *seq_out, int len,uchar* RM1,uchar *RM2,in } if(enc) { - - for(int k=0;k0;a--) { - Z[a-1]=Z[a]^Y[a]; - } - - - for(int a=0;a(fX, RM2, Sbox2); } for(int a=0;a