From d5da4807849b6db899a336b7f831057c280707c0 Mon Sep 17 00:00:00 2001 From: tGautot <44877251+tGautot@users.noreply.github.com> Date: Wed, 8 Sep 2021 15:17:43 +0200 Subject: [PATCH] Comments for libs, put global funcs as static --- hashing/md5.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hashing/md5.cpp b/hashing/md5.cpp index 2c2b728d3..bba7eee57 100644 --- a/hashing/md5.cpp +++ b/hashing/md5.cpp @@ -42,10 +42,10 @@ #include // Used for std::copy #include // To avoid c-style array (thanks clang-tidy) -#include +#include // Used for assert #include // Used for std::memcopy -#include -#include +#include // Used for IO operations +#include // Used for strings #include // To avoid c-style array of runtime size (thanks clang-tidy) /** @@ -308,7 +308,7 @@ void* hash(const std::string& message) { * @brief Self-test implementations of well-known MD5 hashes * @returns void */ -void test() { +static void test() { void* sig = hashing::md5::hash(""); std::cout << "Hashing empty string" << std::endl; std::cout << hashing::md5::sig2hex(sig) << std::endl << std::endl; @@ -348,7 +348,7 @@ void test() { * computed and printed * @returns void */ -void interactive() { +static void interactive() { while (true) { std::string input; std::cout << "Enter a message to be hashed (only one line): " @@ -360,11 +360,15 @@ void interactive() { } /** - * @brief Main function, calls the tests and then invokes interactive mode + * @brief Main function + * Calls the tests and then invokes interactive mode * @returns 0 on exit */ int main() { test(); // run self-test implementations + + // Launch interactive mode where user can input messages and see + // their hash interactive(); return 0; }