X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/4d9a4865f4446306e2815ac4da409c92243b85b2..e8fec7a5f017a7d7d7d0102e4181745340cf8908:/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 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