Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
test_hash_functions.cpp File Reference
#include <boost/test/included/unit_test.hpp>
#include <fc/crypto/hex.hpp>
#include <fc/crypto/sha3.hpp>
#include <fc/utility.hpp>
Include dependency graph for test_hash_functions.cpp:

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   hash_functions
 

Functions

 BOOST_AUTO_TEST_CASE (sha3)
 
 FC_LOG_AND_RETHROW ()
 
 BOOST_AUTO_TEST_CASE (keccak256)
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   hash_functions

Definition at line 1 of file test_hash_functions.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( keccak256 )

Definition at line 41 of file test_hash_functions.cpp.

41 {
42
43 using test_keccak256 = std::tuple<std::string, std::string>;
44 const std::vector<test_keccak256> tests {
45 //test
46 {
47 "",
48 "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
49 },
50
51 //test
52 {
53 "abc",
54 "4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45",
55 },
56
57 //test
58 {
59 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
60 "45d3b367a6904e6e8d502ee04999a7c27647f91fa845d456525fd352ae3d7371",
61 }
62 };
63
64 for(const auto& test : tests) {
65 BOOST_CHECK_EQUAL(fc::sha3::hash(std::get<0>(test), false).str(), std::get<1>(test));
66 }
67
static sha3 hash(const char *d, uint32_t dlen, bool is_nist=true)
Definition sha3.hpp:25
return str
Definition CLI11.hpp:1359
FC_LOG_AND_RETHROW()
Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( sha3 )

Definition at line 11 of file test_hash_functions.cpp.

11 {
12
13 using test_sha3 = std::tuple<std::string, std::string>;
14 const std::vector<test_sha3> tests {
15 //test
16 {
17 "",
18 "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a",
19 },
20
21 //test
22 {
23 "abc",
24 "3a985da74fe225b2045c172d6bd390bd855f086e3e9d525b46bfe24511431532",
25 },
26
27 //test
28 {
29 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
30 "41c0dba2a9d6240849100376a8235e2c82e1b9998a999e21db32dd97496d3376",
31 }
32 };
33
34 for(const auto& test : tests) {
35 BOOST_CHECK_EQUAL(fc::sha3::hash(std::get<0>(test), true).str(), std::get<1>(test));
36 }
37
Here is the call graph for this function:

◆ FC_LOG_AND_RETHROW()

FC_LOG_AND_RETHROW ( )