mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-13 07:28:14 +00:00
fix: resolve all remaining compilation warnings
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user