1#define BOOST_TEST_MODULE hash_functions
2#include <boost/test/included/unit_test.hpp>
10BOOST_AUTO_TEST_SUITE(hash_functions)
13 using test_sha3 = std::tuple<std::string, std::string>;
14 const std::vector<test_sha3> tests {
18 "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a",
24 "3a985da74fe225b2045c172d6bd390bd855f086e3e9d525b46bfe24511431532",
29 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
30 "41c0dba2a9d6240849100376a8235e2c82e1b9998a999e21db32dd97496d3376",
34 for(
const auto& test : tests) {
35 BOOST_CHECK_EQUAL(
fc::sha3::hash(std::get<0>(test),
true).str(), std::get<1>(test));
43 using test_keccak256 = std::tuple<std::string, std::string>;
44 const std::vector<test_keccak256> tests {
48 "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
54 "4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45",
59 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
60 "45d3b367a6904e6e8d502ee04999a7c27647f91fa845d456525fd352ae3d7371",
64 for(
const auto& test : tests) {
65 BOOST_CHECK_EQUAL(
fc::sha3::hash(std::get<0>(test),
false).str(), std::get<1>(test));
70BOOST_AUTO_TEST_SUITE_END()
static sha3 hash(const char *d, uint32_t dlen, bool is_nist=true)
BOOST_AUTO_TEST_CASE(sha3)