diff --git a/.vscode/settings.json b/.vscode/settings.json index 523d638..bb68440 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "C_Cpp.errorSquiggles": "enabled", "files.associations": { + "*.dss": "python", "functional": "cpp", "thread": "cpp", "cctype": "cpp", @@ -96,7 +97,12 @@ "stacktrace": "cpp", "*.ipp": "cpp", "format": "cpp", - "stdfloat": "cpp" + "stdfloat": "cpp", + "*.inc": "cpp", + "text_encoding": "cpp" + }, + "workbench.editorAssociations": { + "*.bin": "hexEditor.hexedit" }, "workbench.colorCustomizations": { @@ -157,5 +163,12 @@ "cmake.configureOnOpen": false, "cmake.options.statusBarVisibility": "hidden", - "git.openRepositoryInParentFolders": "never" + "git.openRepositoryInParentFolders": "never", + + "python.languageServer": "None", + + "files.eol": "\r\n", + + "workbench.iconTheme": "material-icon-theme", + "workbench.colorTheme": "Aramok's GLX Black" } diff --git a/CMakeLists.txt b/CMakeLists.txt index 24aa76a..f195277 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,8 +87,9 @@ if (UNIX) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='$ORIGIN'") target_link_libraries(${OMNIA_STD_LIB} PUBLIC tinfo boost_regex) target_link_libraries(${OMNIA_GFX_LIB} PUBLIC xcb xcb-randr) -endif (UNIX) +endif (UNIX) target_link_libraries(${OMNIA_GFX_LIB} PUBLIC SDL2main SDL2 SDL2_gfx SDL2_ttf) +target_link_libraries(${OMNIA_STD_LIB} PUBLIC ssl crypto) #----------------------------------------------------------------------------------------- #Finalize diff --git a/build.nr b/build.nr index 824cab0..3aad5e8 100644 --- a/build.nr +++ b/build.nr @@ -1 +1 @@ -1867 +1872 diff --git a/src/ostd/Utils.cpp b/src/ostd/Utils.cpp index b5769ed..9dcb381 100755 --- a/src/ostd/Utils.cpp +++ b/src/ostd/Utils.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #define __get_local_time() \ std::time_t __cur_t = std::time(0); \ @@ -423,7 +424,7 @@ namespace ostd case 6: return "Sa"; default: return "Unknown day"; } - } + } @@ -436,7 +437,7 @@ namespace ostd { if (__destination == nullptr) { - std::cout << "\n\n" << termcolor::magenta << "====> "; + std::cout << "\n" << termcolor::magenta << "====> "; std::cout << termcolor::cyan << "Starting test for ["; std::cout << termcolor::green << m_name; std::cout << termcolor::cyan << "]"; @@ -446,11 +447,11 @@ namespace ostd else { m_dest = __destination; - m_dest->nl().nl().fg("magenta").p("====> "); + m_dest->nl().fg("magenta").p("====> "); m_dest->fg("cyan").p("Starting test for ["); m_dest->fg("green").p(m_name); m_dest->fg("cyan").p("]"); - m_dest->nl().nl().fg("magenta").p(" <===="); + m_dest->fg("magenta").p(" <===="); m_dest->reset().nl(); } } @@ -530,7 +531,7 @@ namespace ostd { if (m_dest == nullptr) { - std::cout << "\n" << termcolor::magenta << "====> "; + std::cout << termcolor::magenta << "====> "; std::cout << termcolor::cyan << "Test for ["; std::cout << termcolor::green << m_name; std::cout << termcolor::cyan << "] took "; @@ -540,7 +541,7 @@ namespace ostd } else { - m_dest->nl().fg("magenta").p("====> "); + m_dest->fg("magenta").p("====> "); m_dest->fg("cyan").p("Test for ["); m_dest->fg("green").p(m_name); m_dest->fg("cyan").p("] took "); @@ -829,4 +830,24 @@ namespace ostd } return out_string; } + + String Utils::md5(const String& str) + { + using namespace std; + EVP_MD_CTX* context = EVP_MD_CTX_new(); + const EVP_MD* md = EVP_md5(); + unsigned char md_value[EVP_MAX_MD_SIZE]; + unsigned int md_len; + string output; + + EVP_DigestInit_ex2(context, md, NULL); + EVP_DigestUpdate(context, str.c_str(), str.len()); + EVP_DigestFinal_ex(context, md_value, &md_len); + EVP_MD_CTX_free(context); + + output.resize(md_len * 2); + for (unsigned int i = 0 ; i < md_len ; ++i) + std::sprintf(&output[i * 2], "%02x", md_value[i]); + return output; + } } diff --git a/src/ostd/Utils.hpp b/src/ostd/Utils.hpp index 3e944fe..03f6cc6 100755 --- a/src/ostd/Utils.hpp +++ b/src/ostd/Utils.hpp @@ -182,6 +182,7 @@ namespace ostd static bool loadByteStreamFromFile(const String& filePath, ByteStream& outStream); static ByteStream stringToByteStream(const String& data); static String byteStreamToString(const ByteStream& data); + static String md5(const String& str); //Implemented in static std::vector listFilesInDirectory(const String& directoryPath);