From: couturie Date: Sun, 18 Feb 2018 13:34:12 +0000 (+0100) Subject: new hash X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/commitdiff_plain/7b02553c06f361be8c2f181d0a6cb4cd6b4fdb39 new hash --- diff --git a/IDA/Makefile b/IDA/Makefile index 20a836f..a2afb98 100644 --- a/IDA/Makefile +++ b/IDA/Makefile @@ -8,5 +8,8 @@ LIBS= -larmadillo -lopenblas test_mat2: test_mat2.cpp g++ -std=c++11 $(CPP_FLAGS) -o $@ $< $(LIBS) +ida: ida.cpp + g++ -std=c++11 $(CPP_FLAGS) -o $@ $< $(LIBS) + clean: - rm test_mat2 + rm test_mat2 ida diff --git a/OneRoundIoT/OneRound/Makefile b/OneRoundIoT/OneRound/Makefile index cb01d4f..a82d3fa 100644 --- a/OneRoundIoT/OneRound/Makefile +++ b/OneRoundIoT/OneRound/Makefile @@ -24,6 +24,9 @@ one_round_new.o: one_round_new.cpp one_round_hash.o: one_round_hash.cpp $(CXX) -c -o $@ $< $(CFLAGS) +one_round_hash_new.o: one_round_hash_new.cpp + $(CXX) -c -o $@ $< $(CFLAGS) + one_round_par2.o: one_round_par2.cpp @@ -40,5 +43,8 @@ one_round_par2: pixmap_io.o one_round_par2.o one_round_hash: pixmap_io.o one_round_hash.o $(CXX) -o $@ $^ $(CFLAGS) +one_round_hash_new: pixmap_io.o one_round_hash_new.o + $(CXX) -o $@ $^ $(CFLAGS) + clean: - rm -rf *.o one_round_new one_round_hash one_round_par2 + rm -rf *.o one_round_new one_round_hash one_round_par2 one_round_hash_new diff --git a/OneRoundIoT/OneRound/one_round_hash.cpp b/OneRoundIoT/OneRound/one_round_hash.cpp index c04dfda..e67d4bb 100644 --- a/OneRoundIoT/OneRound/one_round_hash.cpp +++ b/OneRoundIoT/OneRound/one_round_hash.cpp @@ -1,6 +1,9 @@ //gcc pixmap_io.c -c //g++ -O3 one_round_test.cpp pixmap_io.o -o one_round_test -std=c++11 +// + + #include #include #include @@ -340,9 +343,6 @@ int main(int argc, char** argv) { } } - if(change) { - buffer[4]++; - } @@ -366,8 +366,14 @@ int main(int argc, char** argv) { } + if(change) { + + seq[4]++; + } + + int total_len=imsize; int rp=1; @@ -434,18 +440,20 @@ int main(int argc, char** argv) { RM2[i]=RM1[i]; } + cout<<"imsize "< +#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; +int nb_test=1; +int ctr=0; + + + + + + + +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;i0;a--) { + Z[a-1]=Sbox2[Z[a]^Y[a]]; + } +*/ + + Y[0]=X[0]^X[h-1]; + for(int a=1;a0;a--) { + Z[a-1]=Z[a]^Y[a]; + } + + for(int a=0;a