fix: resolve all remaining compilation warnings

This commit is contained in:
zukrmn
2026-03-08 22:40:41 +01:00
committed by JuiceyDev
parent 00148791f4
commit 42b0352ec3
26 changed files with 51 additions and 40 deletions
+9 -6
View File
@@ -8,6 +8,7 @@
#include <sstream>
#endif // _WIN32
#include "Hasher.h"
#include <openssl/evp.h>
Hasher::Hasher(wstring &salt)
{
@@ -36,13 +37,15 @@ wstring Hasher::getHash(wstring &name)
// adapted from a SSL example
std::wstring combined = salt + name;
std::string combined_str(combined.begin(), combined.end());
unsigned char result[MD5_DIGEST_LENGTH];
MD5_CTX md5_ctx;
MD5_Init(&md5_ctx);
MD5_Update(&md5_ctx, combined_str.c_str(), combined_str.size());
MD5_Final(result, &md5_ctx);
unsigned char result[EVP_MAX_MD_SIZE];
EVP_MD_CTX* md5_ctx = EVP_MD_CTX_new();
EVP_DigestInit_ex(md5_ctx, EVP_md5(), NULL);
EVP_DigestUpdate(md5_ctx, combined_str.c_str(), combined_str.size());
unsigned int result_len;
EVP_DigestFinal_ex(md5_ctx, result, &result_len);
EVP_MD_CTX_free(md5_ctx);
std::stringstream ss;
for (int i = 0; i < MD5_DIGEST_LENGTH; i++)
for (unsigned int i = 0; i < result_len; i++)
{
ss << std::setw(2) << std::setfill('0') << std::hex << (int)result[i];
}