X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/f1db4350eede84fe1dddead262a32becc1306fda..4095e8a185238f0a37bbce6cb4c084e28e46bbeb:/OneRoundIoT/OneRound/one_round_auth.cpp?ds=sidebyside diff --git a/OneRoundIoT/OneRound/one_round_auth.cpp b/OneRoundIoT/OneRound/one_round_auth.cpp index 9062cad..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,48 +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