3#include <c++utilities/conversion/stringconversion.h>
4#include <c++utilities/tests/testutils.h>
6#include <cppunit/TestFixture.h>
7#include <cppunit/extensions/HelperMacros.h>
14using namespace CppUtilities::Literals;
16using namespace CPPUNIT_NS;
25 CPPUNIT_TEST_SUITE_END();
28 void setUp()
override;
47 const char someString[] =
"hello world";
51 for (
unsigned char hashNumber : sum.
data) {
52 const string digits = numberToString(hashNumber,
static_cast<unsigned char>(16));
53 sumAsHex.push_back(digits.size() < 2 ?
'0' : digits.front());
54 sumAsHex.push_back(digits.back());
56 CPPUNIT_ASSERT_EQUAL(
"430646847E70344C09F58739E99D5BC96EAC8D5FE7295CF196B986279876BF9B"s, sumAsHex);
The OpenSslUtilsTests class tests the functions in the Util::OpenSsl namespace.
void testComputeSha256Sum()
void testGenerateRandomNumber()
Contains functions utilizing the usage of OpenSSL.
PASSWORD_FILE_EXPORT std::uint32_t generateRandomNumber(std::uint32_t min, std::uint32_t max)
PASSWORD_FILE_EXPORT Sha256Sum computeSha256Sum(const unsigned char *buffer, std::size_t size)
Computes a SHA-256 sum using OpenSSL.
CPPUNIT_TEST_SUITE_REGISTRATION(OpenSslUtilsTests)