OpenVPN 3 Core Library
Loading...
Searching...
No Matches
test_crypto_hashstr.cpp
Go to the documentation of this file.
1#include "test_common.hpp"
2
7
8using namespace openvpn;
9
10TEST(crypto, hashstr)
11{
12 const std::string content = read_text_utf8(UNITTEST_SOURCE_DIR "/input/1984.txt");
13
15 HashString hash(*digest_factory, CryptoAlgs::MD5);
16 hash.update(content);
17 const std::string actual = hash.final_hex();
18 const std::string expected = "2bea7a83bf94971af26372126ebba7e3";
19 ASSERT_EQ(actual, expected);
20}
std::string final_hex()
Definition hashstr.hpp:68
void update(const std::string &str)
Definition hashstr.hpp:32
std::string read_text_utf8(const std::string &filename, const std::uint64_t max_size=0)
Definition file.hpp:136
TEST(crypto, hashstr)
const std::string expected