From: hn Date: Sun, 15 Apr 2018 15:50:22 +0000 (+0200) Subject: new version of improved one round X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/commitdiff_plain/e8a8b4d9c7d32c2d90c0b8c1ac63f47c3959116a new version of improved one round --- diff --git a/Old_one_round/one_round_light_v2.cpp b/Old_one_round/one_round_light_v2.cpp new file mode 100644 index 0000000..d660bc4 --- /dev/null +++ b/Old_one_round/one_round_light_v2.cpp @@ -0,0 +1,549 @@ +//gcc pixmap_io.c -c +//g++ -O3 one_round_light_v2.cpp pixmap_io.o -o one_round_light_v2 -std=c++11 + +#include +#include +#include +#include +#include +#include +#include + +/*#include +#include +#include +#include +*/ + + +extern "C" { + int load_RGB_pixmap(char *filename, int *width, int *height, unsigned char**R_data, unsigned char**G_data, unsigned char**B_data); + void store_RGB_pixmap(char *filename, unsigned char *R_data, unsigned char *G_data, unsigned char *B_data, int width, int height); +} + + +//using namespace CryptoPP; +using namespace std; + + +int key_size=256; + + +const int h=64; +const int h2=h*h; + + + +typedef unsigned char uchar; + + +double TimeStart() +{ + struct timeval tstart; + gettimeofday(&tstart,0); + return( (double) (tstart.tv_sec + tstart.tv_usec*1e-6) ); +} + +double TimeStop(double t) +{ + struct timeval tend; + + gettimeofday(&tend,0); + t = (double) (tend.tv_sec + tend.tv_usec*1e-6) - t; + return (t); +} + + + + + + +void inverse_tables(uchar *tab, int size_tab,uchar *inv_perm_tabs) { + + for(int i=0;i=0;it--) { + int ind1=it*h2; + int ind2=Pbox[it]*h2; + + + + for(int a=0;a=0;it--) { + int ind1=it*h2; + int ind2=Pbox[it]*h2; + + + + + + for(int a=0;a