From: Raphaƫl Couturier Date: Sun, 7 Jul 2019 14:56:31 +0000 (+0200) Subject: new hash X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/commitdiff_plain/79aec327ce44be77f38c34b8b4cac32cb4b07610?ds=sidebyside new hash --- diff --git a/IDA_new/ida_gf65_paper1 b/IDA_new/ida_gf65_paper1 deleted file mode 100755 index 8c88845..0000000 Binary files a/IDA_new/ida_gf65_paper1 and /dev/null differ diff --git a/OneRoundIoT/EnhancedOneRound/Simon_speck/C/user_tool.c b/OneRoundIoT/EnhancedOneRound/Simon_speck/C/user_tool.c index d113388..33cebf7 100644 --- a/OneRoundIoT/EnhancedOneRound/Simon_speck/C/user_tool.c +++ b/OneRoundIoT/EnhancedOneRound/Simon_speck/C/user_tool.c @@ -1,3 +1,6 @@ +////USAGE : ./user speck_256_128 ECB -e key lena.ppm tests.cip + + //user simon_64_32 12 -e key tests tests.cip // diff --git a/OneRoundIoT/OneRound/Makefile b/OneRoundIoT/OneRound/Makefile index 4f7f2f4..2b99c8a 100644 --- a/OneRoundIoT/OneRound/Makefile +++ b/OneRoundIoT/OneRound/Makefile @@ -36,6 +36,9 @@ one_round_hash.o: one_round_hash.cpp one_round_hash_new.o: one_round_hash_new.cpp $(CXX) -c -o $@ $< $(CFLAGS) +one_round_hash_new2.o: one_round_hash_new2.cpp + $(CXX) -c -o $@ $< $(CFLAGS) + one_round_par2.o: one_round_par2.cpp @@ -61,6 +64,9 @@ one_round_hash: pixmap_io.o one_round_hash.o one_round_hash_new: pixmap_io.o one_round_hash_new.o $(CXX) -o $@ $^ $(CFLAGS) +one_round_hash_new2: pixmap_io.o one_round_hash_new2.o + $(CXX) -o $@ $^ $(CFLAGS) + one_round_auth: pixmap_io.o one_round_auth.o $(CXX) -o $@ $^ $(CFLAGS) diff --git a/OneRoundIoT/OneRound/one_round_hash_new2.cpp b/OneRoundIoT/OneRound/one_round_hash_new2.cpp new file mode 100644 index 0000000..25bcb17 --- /dev/null +++ b/OneRoundIoT/OneRound/one_round_hash_new2.cpp @@ -0,0 +1,389 @@ +//gcc pixmap_io.c -c +//g++ -O3 one_round_hash_new.cpp pixmap_io.o -o one_round_hash_new -std=c++11 + +// + + +#include +#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;i> (8 - n));} + + +//the proposed hash function, which is based on DSD structure. Sensitivity is ensured by employing the binary diffusion + +void hash_DSD_BIN(uchar* seq_in, uchar* RM1,int len, int *PboxRM, uchar *Sbox1, uchar *Sbox2, int h) { + + + // Goal: Calculate the hash value + // Output: RM (hash value) + +// uchar *X=new uchar[h2]; +// uchar *fX=new uchar[h2]; + uchar X[h]; + int ind2; + + + + for(int it=0;it