From 21e870b486a45199812490d9668534f7255c3ff1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Couturier?= Date: Tue, 25 Feb 2020 20:41:34 +0100 Subject: [PATCH] add other hash --- IDA_new/jerasure/config.log | 5 +- IDA_new/jerasure/configure.ac | 2 +- OneRoundIoT/OneRound/Makefile | 3 + OneRoundIoT/OneRound/rc4_hash.cpp | 389 ++++++++++++++++++++++++++++++ 4 files changed, 395 insertions(+), 4 deletions(-) create mode 100644 OneRoundIoT/OneRound/rc4_hash.cpp diff --git a/IDA_new/jerasure/config.log b/IDA_new/jerasure/config.log index ab1a8b4..46913f1 100644 --- a/IDA_new/jerasure/config.log +++ b/IDA_new/jerasure/config.log @@ -35,7 +35,6 @@ PATH: /usr/bin PATH: /usr/sbin/ PATH: /usr/local/bin PATH: /usr/X11R6/bin -PATH: /home/couturie/Cipher_code/IDA_new/gf-complete PATH: /home/couturie/work/Cipher_code/IDA_new/gf-complete @@ -612,7 +611,7 @@ configure:12370: gcc -o conftest -g -O3 -Wall conftest.c -lgf_complete >&5 configure:12370: $? = 0 configure:12370: ./conftest configure:12370: $? = 0 -configure:12380: result: 806ea:2100800:7ffafbff:bfebfbff +configure:12380: result: 806ea:3100800:7ffafbff:bfebfbff configure:12397: checking whether mmx is supported configure:12409: result: yes configure:12412: checking whether sse is supported @@ -843,7 +842,7 @@ ax_cv_check_cflags___msse4_2=yes ax_cv_check_cflags___msse=yes ax_cv_check_cflags___mssse3=yes ax_cv_gcc_x86_avx_xgetbv_0x00000000=1f:0 -ax_cv_gcc_x86_cpuid_0x00000001=806ea:2100800:7ffafbff:bfebfbff +ax_cv_gcc_x86_cpuid_0x00000001=806ea:3100800:7ffafbff:bfebfbff ax_cv_have_avx_cpu_ext=yes ax_cv_have_avx_ext=yes ax_cv_have_mmx_ext=yes diff --git a/IDA_new/jerasure/configure.ac b/IDA_new/jerasure/configure.ac index 0cca9a8..5d6abe3 100644 --- a/IDA_new/jerasure/configure.ac +++ b/IDA_new/jerasure/configure.ac @@ -9,7 +9,7 @@ AC_CONFIG_HEADERS([include/config.h]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE([1.13 -Wall -Wno-extra-portability]) +AM_INIT_AUTOMAKE([1.16 -Wall -Wno-extra-portability]) # Package default C compiler flags. dnl This must be before LT_INIT and AC_PROG_CC. diff --git a/OneRoundIoT/OneRound/Makefile b/OneRoundIoT/OneRound/Makefile index a300f32..4eb5c44 100644 --- a/OneRoundIoT/OneRound/Makefile +++ b/OneRoundIoT/OneRound/Makefile @@ -72,6 +72,9 @@ one_round_hash_new2: pixmap_io.o one_round_hash_new2.o one_round_hash_new3: pixmap_io.o one_round_hash_new3.o $(CXX) -o $@ $^ $(CFLAGS) +rc4_hash: pixmap_io.o rc4_hash.o + $(CXX) -o $@ $^ $(CFLAGS) + one_round_auth: pixmap_io.o one_round_auth.o $(CXX) -o $@ $^ $(CFLAGS) diff --git a/OneRoundIoT/OneRound/rc4_hash.cpp b/OneRoundIoT/OneRound/rc4_hash.cpp new file mode 100644 index 0000000..d088af7 --- /dev/null +++ b/OneRoundIoT/OneRound/rc4_hash.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, uchar *S, 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 ind1,ind2; + + for(int it=0;it