aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2018-09-26 04:15:56 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2018-09-26 12:56:53 +0800
commit0f1d8d44150fe2cd8e77dd76638bd25caa283b26 (patch)
treeba2d436a38455b3226fb030c424a67f2a2b1862d
parent51efcd19a5e7e033128b4f194e39b6e2f6dab4e9 (diff)
downloaddexon-mcl-0f1d8d44150fe2cd8e77dd76638bd25caa283b26.tar.gz
dexon-mcl-0f1d8d44150fe2cd8e77dd76638bd25caa283b26.tar.zst
dexon-mcl-0f1d8d44150fe2cd8e77dd76638bd25caa283b26.zip
remove sha1 in test
-rw-r--r--test/fp_test.cpp12
1 files 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 <cybozu/benchmark.hpp>
#include <cybozu/option.hpp>
#ifdef MCL_DONT_USE_OPENSSL
-#include <cybozu/sha1.hpp>
+#include <cybozu/sha2.hpp>
#else
#include <cybozu/crypto.hpp>
#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;