From e8a8b4d9c7d32c2d90c0b8c1ac63f47c3959116a Mon Sep 17 00:00:00 2001 From: hn Date: Sun, 15 Apr 2018 17:50:22 +0200 Subject: [PATCH] new version of improved one round --- Old_one_round/one_round_light_v2.cpp | 549 +++++++++++++++++++++++++++ 1 file changed, 549 insertions(+) create mode 100644 Old_one_round/one_round_light_v2.cpp 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