From 0f1d8d44150fe2cd8e77dd76638bd25caa283b26 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 26 Sep 2018 05:15:56 +0900 Subject: [PATCH] remove sha1 in test --- test/fp_test.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/fp_test.cpp b/test/fp_test.cpp index 5a478fe..f883b24 100644 --- a/test/fp_test.cpp +++ b/test/fp_test.cpp @@ -8,7 +8,7 @@ #include #include #ifdef MCL_DONT_USE_OPENSSL -#include +#include #else #include #endif @@ -725,11 +725,15 @@ void setHashOfTest() "", "abc", "111111111111111111111111111111111111", }; for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(msgTbl); i++) { + size_t bitSize = Fp::getBitSize(); #ifdef MCL_DONT_USE_OPENSSL - cybozu::Sha1 sha1; - std::string digest = sha1.digest(msgTbl[i]); + std::string digest; + if (bitSize <= 256) { + digest = cybozu::Sha256(msgTbl[i].c_str(), msgTbl[i].size()).get(); + } else { + digest = cybozu::Sha512(msgTbl[i].c_str(), msgTbl[i].size()).get(); + } #else - size_t bitSize = Fp::getBitSize(); cybozu::crypto::Hash::Name name; if (bitSize <= 256) { name = cybozu::crypto::Hash::N_SHA256;