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
3
#include <
openvpn/common/file.hpp
>
4
#include <
openvpn/ssl/sslchoose.hpp
>
5
#include <
openvpn/crypto/cryptoalgs.hpp
>
6
#include <
openvpn/crypto/hashstr.hpp
>
7
8
using namespace
openvpn
;
9
10
TEST
(crypto, hashstr)
11
{
12
const
std::string content =
read_text_utf8
(UNITTEST_SOURCE_DIR
"/input/1984.txt"
);
13
14
DigestFactory::Ptr
digest_factory(
new
CryptoDigestFactory<SSLLib::CryptoAPI>
());
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
}
openvpn::CryptoDigestFactory
Definition
digestapi.hpp:122
openvpn::HashString
Definition
hashstr.hpp:24
openvpn::HashString::final_hex
std::string final_hex()
Definition
hashstr.hpp:68
openvpn::HashString::update
void update(const std::string &str)
Definition
hashstr.hpp:32
openvpn::RCPtr< DigestFactory >
cryptoalgs.hpp
file.hpp
hashstr.hpp
openvpn::CryptoAlgs::MD5
@ MD5
Definition
cryptoalgs.hpp:78
openvpn
Definition
ovpncli.cpp:97
openvpn::read_text_utf8
std::string read_text_utf8(const std::string &filename, const std::uint64_t max_size=0)
Definition
file.hpp:136
sslchoose.hpp
test_common.hpp
TEST
TEST(crypto, hashstr)
Definition
test_crypto_hashstr.cpp:10
expected
const std::string expected
Definition
test_format.cpp:32
test
unittests
test_crypto_hashstr.cpp
Generated by
1.9.8