From ff9e923170329eacc0f53ba1c9673622b6f8b5a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Couturier?= Date: Tue, 3 Aug 2021 13:00:07 +0200 Subject: [PATCH 1/1] new --- OneRoundHash/oneroundhash.cpp | 139 +++++++++++++++++++++++++++++----- 1 file changed, 122 insertions(+), 17 deletions(-) diff --git a/OneRoundHash/oneroundhash.cpp b/OneRoundHash/oneroundhash.cpp index 8eb527b..642dc07 100644 --- a/OneRoundHash/oneroundhash.cpp +++ b/OneRoundHash/oneroundhash.cpp @@ -34,6 +34,7 @@ int nb_test=1; int v1b=0; int v2b1=0; int v2b2=0; +int v2b3=0; @@ -209,18 +210,13 @@ void encrypt_authenticate_algorithm(uchar* seq_in, uchar *seq_out, int len, uch rm2[a]=myrand; } - for(int a=0;a +void encrypt_authenticate_algorithm_2Blocks_V3(uchar* seq_in, uchar *seq_out, int len, uchar* RM, int *Pbox, int *PboxSRM, uchar *Sbox1, uchar *Sbox2, uchar* IV,mylong myrand) { + uchar RM1[h]; + uchar tmp1[h]; + mylong *rm1=(mylong*)RM1; + + for(int it=0;it>3);a++) { + myrand=xorshift64(); + rm1[a]=myrand; + } + + for(int a=0;a +void decrypt_authenticate_algorithm_2Blocks_V3(uchar* seq_in, uchar *seq_out, int len, uchar* RM, int *Pbox, int *PboxSRM, uchar *Inv_Sbox1, uchar *Inv_Sbox2 ,uchar *Sbox1, uchar *Sbox2, uchar* IV,mylong myrand) { + uchar RM1[h]; + uchar tmp1[h]; + mylong *rm1=(mylong*)RM1; + + for(int it=0;it>3);a++) { + myrand=xorshift64(); + rm1[a]=myrand; + } + + for(int a=0;a(seq, seq2,len,RM,Pbox,PboxSRM,Sbox1,Sbox2,IV1,IV2,MAC,myrand); if(v2b2) encrypt_authenticate_algorithm_2Blocks_V2<32>(seq, seq2,len,RM,Pbox,PboxSRM,Sbox1,Sbox2,IV1,IV2,MAC,myrand); + if(v2b3) + encrypt_authenticate_algorithm_2Blocks_V3<32>(seq, seq2,len,RM,Pbox,PboxSRM,Sbox1,Sbox2,IV1,myrand); } break; } @@ -1041,6 +1144,8 @@ int main(int argc, char** argv) { decrypt_authenticate_algorithm_2Blocks<32>(seq2, seq,len,RM,Pbox,PboxSRM,Inv_Sbox1,Inv_Sbox2,Sbox1,Sbox2,IV1,IV2,MAC,myrand); if(v2b2) decrypt_authenticate_algorithm_2Blocks_V2<32>(seq2, seq,len,RM,Pbox,PboxSRM,Inv_Sbox1,Inv_Sbox2,Sbox1,Sbox2,IV1,IV2,MAC,myrand); + if(v2b3) + decrypt_authenticate_algorithm_2Blocks_V3<32>(seq2, seq,len,RM,Pbox,PboxSRM,Inv_Sbox1,Inv_Sbox2,Sbox1,Sbox2,IV1,myrand); } break; } -- 2.39.5