From e7a7c5b3295e50df0018f3429e2b20729cb08f2f Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Wed, 15 Dec 2021 13:43:30 +0100 Subject: Added MD5 tests --- zencore/md5.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'zencore/md5.cpp') diff --git a/zencore/md5.cpp b/zencore/md5.cpp index bf11a6b3a..a5a5ea41d 100644 --- a/zencore/md5.cpp +++ b/zencore/md5.cpp @@ -6,6 +6,7 @@ #include #include +#include /* ********************************************************************** @@ -438,6 +439,23 @@ toString(const MD5& value) TEST_CASE("MD5") { + using namespace std::literals; + + auto Input = "jumblesmcgee"sv; + auto Output = "28f2200a59c60b75947099d750c2cc50"sv; + + MD5Stream Stream; + Stream.Append(Input.data(), Input.length()); + MD5 Result = Stream.GetHash(); + + MD5::String_t Buffer; + Result.ToHexString(Buffer); + + CHECK(Output.compare(Buffer)); + + MD5 Reresult = MD5::FromHexString(Buffer); + Reresult.ToHexString(Buffer); + CHECK(Output.compare(Buffer)); } #endif -- cgit v1.2.3