From bd0fd45010fd0c1803d6368bd7d7dab255615f51 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Couturier?= Date: Wed, 4 Mar 2020 12:05:39 +0100 Subject: [PATCH 1/1] new --- OneRoundIoT/OneRound/one_round_hash_new2.cpp | 22 +++++------ OneRoundIoT/OneRound/one_round_hash_new3.cpp | 22 +++++------ OneRoundIoT/OneRound/run_hash_throughput.py | 39 ++++++++++++++++++++ OneRoundIoT/openssl/openssl_evp_cmac.c | 2 +- OneRoundIoT/openssl/openssl_evp_hmac.c | 2 +- 5 files changed, 63 insertions(+), 24 deletions(-) create mode 100644 OneRoundIoT/OneRound/run_hash_throughput.py diff --git a/OneRoundIoT/OneRound/one_round_hash_new2.cpp b/OneRoundIoT/OneRound/one_round_hash_new2.cpp index ae346fe..911d7f3 100644 --- a/OneRoundIoT/OneRound/one_round_hash_new2.cpp +++ b/OneRoundIoT/OneRound/one_round_hash_new2.cpp @@ -212,9 +212,9 @@ int main(int argc, char** argv) { } - cout< exe_hash_throughtput.txt + +import subprocess +import re + + + +print("#size \t h \t time") +print("variant 1"); +h=8 +for k in range(1,6): + result=subprocess.check_output("one_round_hash_new2 lena1 nb100 h"+str(h),shell=True) + res=result.decode() + print(str(512*512*3)+"\t"+str(h)+"\t"+res) + h=h+h + +print("variant 2"); +h=8 +for k in range(1,6): + result=subprocess.check_output("one_round_hash_new3 lena1 nb100 h"+str(h),shell=True) + res=result.decode() + print(str(512*512*3)+"\t"+str(h)+"\t"+res) + h=h+h + +print("cmac"); +h=8 +for k in range(1,6): + result=subprocess.check_output("../openssl/openssl_evp_cmac lena1 nb100 h"+str(h),shell=True) + res=result.decode() + print(str(512*512*3)+"\t"+str(h)+"\t"+res) + h=h+h + +print("hmac"); +h=8 +for k in range(1,6): + result=subprocess.check_output("../openssl/openssl_evp_hmac lena1 nb100 h"+str(h),shell=True) + res=result.decode() + print(str(512*512*3)+"\t"+str(h)+"\t"+res) + h=h+h diff --git a/OneRoundIoT/openssl/openssl_evp_cmac.c b/OneRoundIoT/openssl/openssl_evp_cmac.c index d8c0377..f1d3984 100755 --- a/OneRoundIoT/openssl/openssl_evp_cmac.c +++ b/OneRoundIoT/openssl/openssl_evp_cmac.c @@ -118,7 +118,7 @@ unsigned char mact[16] = {0}; if(1 != CMAC_Final(ctx, mact, &mactlen)) handleErrors(); ciphertext_len += len; - printBytes(mact, mactlen); + // printBytes(mact, mactlen); /* Clean up */ CMAC_CTX_free(ctx); diff --git a/OneRoundIoT/openssl/openssl_evp_hmac.c b/OneRoundIoT/openssl/openssl_evp_hmac.c index 59f5f8a..5e738ea 100644 --- a/OneRoundIoT/openssl/openssl_evp_hmac.c +++ b/OneRoundIoT/openssl/openssl_evp_hmac.c @@ -134,7 +134,7 @@ int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, ciphertext_len += len; - printBytes(hash_sha256, result_len); + // printBytes(hash_sha256, result_len); /* char *p = &hash_sha256_hex[0]; -- 2.39.5