|
|
@ -8,7 +8,7 @@ |
|
|
|
#include <cybozu/benchmark.hpp> |
|
|
|
#include <cybozu/benchmark.hpp> |
|
|
|
#include <cybozu/option.hpp> |
|
|
|
#include <cybozu/option.hpp> |
|
|
|
#ifdef MCL_DONT_USE_OPENSSL |
|
|
|
#ifdef MCL_DONT_USE_OPENSSL |
|
|
|
#include <cybozu/sha1.hpp> |
|
|
|
#include <cybozu/sha2.hpp> |
|
|
|
#else |
|
|
|
#else |
|
|
|
#include <cybozu/crypto.hpp> |
|
|
|
#include <cybozu/crypto.hpp> |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -725,11 +725,15 @@ void setHashOfTest() |
|
|
|
"", "abc", "111111111111111111111111111111111111", |
|
|
|
"", "abc", "111111111111111111111111111111111111", |
|
|
|
}; |
|
|
|
}; |
|
|
|
for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(msgTbl); i++) { |
|
|
|
for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(msgTbl); i++) { |
|
|
|
|
|
|
|
size_t bitSize = Fp::getBitSize(); |
|
|
|
#ifdef MCL_DONT_USE_OPENSSL |
|
|
|
#ifdef MCL_DONT_USE_OPENSSL |
|
|
|
cybozu::Sha1 sha1; |
|
|
|
std::string digest; |
|
|
|
std::string digest = sha1.digest(msgTbl[i]); |
|
|
|
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 |
|
|
|
#else |
|
|
|
size_t bitSize = Fp::getBitSize(); |
|
|
|
|
|
|
|
cybozu::crypto::Hash::Name name; |
|
|
|
cybozu::crypto::Hash::Name name; |
|
|
|
if (bitSize <= 256) { |
|
|
|
if (bitSize <= 256) { |
|
|
|
name = cybozu::crypto::Hash::N_SHA256; |
|
|
|
name = cybozu::crypto::Hash::N_SHA256; |
|
|
|