feat: upgrade session keys to use mersenne twister (#1155)

* upgrade session keys to use mersenne twister

* arithmetic type static assert and windows min/max macro undef
This commit is contained in:
avery
2023-07-23 14:59:43 -07:00
committed by GitHub
parent c791d1a237
commit bd5ead40f6
3 changed files with 43 additions and 24 deletions

View File

@@ -8,6 +8,7 @@
#include "ZoneInstanceManager.h"
#include "MD5.h"
#include "SHA512.h"
#include "GeneralUtils.h"
#ifdef _WIN32
#include <bcrypt/BCrypt.hpp>
@@ -211,7 +212,7 @@ void AuthPackets::SendLoginResponse(dServer* server, const SystemAddress& sysAdd
packet.Write(static_cast<uint16_t>(64)); // Version Minor
// Writes the user key
uint32_t sessionKey = rand(); // not mt but whatever
uint32_t sessionKey = GeneralUtils::GenerateRandomNumber<uint32_t>();
std::string userHash = std::to_string(sessionKey);
userHash = md5(userHash);
PacketUtils::WritePacketWString(userHash, 33, &packet);