fix: resolve all remaining compilation warnings

This commit is contained in:
zukrmn
2026-03-07 04:43:50 +00:00
parent 87c9733e09
commit ca11afdfca
28 changed files with 46 additions and 36 deletions

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];
}