Skip to content

Commit d9292fb

Browse files
Bela Proinsiascore
Bela Proinsias
authored and
core
committed
feat: add new hash function implementation
- reinventing the wheel :)loveu~
1 parent ff21c8e commit d9292fb

File tree

7 files changed

+72
-19
lines changed

7 files changed

+72
-19
lines changed

Diff for: PrivateMenu/PrivateMenu.vcxproj

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@
247247
</ClInclude>
248248
<ClInclude Include="src\menu\util\inventory.h" />
249249
<ClInclude Include="src\menu\util\inventoryTypes.h" />
250+
<ClInclude Include="src\menu\util\joaat.hpp" />
250251
<ClInclude Include="src\menu\util\session.h" />
251252
<ClInclude Include="src\menu\util\socialclub.h" />
252253
<ClInclude Include="src\util\memory\patternBatch.h" />

Diff for: PrivateMenu/PrivateMenu.vcxproj.filters

+1
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@
540540
<ClInclude Include="src\menu\util\socialclub.h" />
541541
<ClInclude Include="src\menu\util\inventoryTypes.h" />
542542
<ClInclude Include="src\menu\util\inventory.h" />
543+
<ClInclude Include="src\menu\util\joaat.hpp" />
543544
</ItemGroup>
544545
<ItemGroup>
545546
<Library Include="minhook.lib" />

Diff for: PrivateMenu/src/authorization/authorization.cpp

+17-18
Original file line numberDiff line numberDiff line change
@@ -432,30 +432,30 @@ Status Authorization::Authorize(String username, String password) {
432432
//} queryConnectionStatus.clear();
433433

434434
authProgress++;
435-
//
436-
//#ifndef TESTER_ONLY
437-
// string isOnline = m_network->Post("kek=MmU5ZjA2MGE");
438-
// authProgress++;
439-
// if (strcmp(isOnline.c_str(), "true")) {
440-
// isOnline.clear();
441-
// return STATUS_MENUOFFLINE;
442-
// } isOnline.clear();
443-
//#endif
444-
445-
//string getVersion = m_network->Post("kek=MTU0MjA0MDc");
446-
//if (!CompareVersion(getVersion)) {
447-
// return STATUS_OUTDATED;
448-
//}
435+
//
436+
//#ifndef TESTER_ONLY
437+
// string isOnline = m_network->Post("kek=MmU5ZjA2MGE");
438+
// authProgress++;
439+
// if (strcmp(isOnline.c_str(), "true")) {
440+
// isOnline.clear();
441+
// return STATUS_MENUOFFLINE;
442+
// } isOnline.clear();
443+
//#endif
444+
445+
//string getVersion = m_network->Post("kek=MTU0MjA0MDc");
446+
//if (!CompareVersion(getVersion)) {
447+
// return STATUS_OUTDATED;
448+
//}
449449

450450
authProgress++;
451-
WAIT(2000);
451+
452452
//string sessionToken = m_network->Post("kek=OTI1YzYzNGY");
453453
authProgress++;
454454
//string accessToken = m_network->Post("kek=Mjc3ZDA1NzQ");
455455

456456
authProgress++;
457457

458-
auto socialClubName = ((char*(*)()) Pattern::Scan("Grabbed", "48 83 EC 28 B1 01 E8 ? ? ? ? 84 C0 74 40"))();
458+
auto socialClubName = ((char* (*)()) Pattern::Scan("Grabbed", "48 83 EC 28 B1 01 E8 ? ? ? ? 84 C0 74 40"))();
459459

460460
SessionMenuVars::vars.DefaultSCName = socialClubName;
461461

@@ -534,7 +534,7 @@ Status Authorization::Authorize(String username, String password) {
534534
authProgress++;
535535

536536
m_hwid = this->GetHWID();
537-
537+
Sleep(2000);
538538
authProgress++;
539539

540540
//string checkUserHwid = m_network->Post(va("kek=MjI2YzA1MGE&nfhacbfg34=%s&fhanvb47s=%s&dgcbahrt33=%s&jfhcbfgh88=%s&fhabcnff=%s", EncryptionHelper::Base64Encode(accessToken).c_str(), EncryptionHelper::Base64Encode(sessionToken).c_str(), EncryptionHelper::Base64Encode(m_username).c_str(), EncryptionHelper::Base64Encode(m_password).c_str(), EncryptionHelper::Base64Encode(m_hwid).c_str()));
@@ -573,7 +573,6 @@ Status Authorization::Authorize(String username, String password) {
573573
//accessToken = m_network->Post("kek=Mjc3ZDA1NzQ");
574574

575575
authProgress++;
576-
WAIT(1000);
577576
//string getUserRank = m_network->Post(va("kek=MWMxNzYyZjg&nfhacbfg34=%s&fhanvb47s=%s&dgcbahrt33=%s&jfhcbfgh88=%s", EncryptionHelper::Base64Encode(accessToken).c_str(), EncryptionHelper::Base64Encode(sessionToken).c_str(), EncryptionHelper::Base64Encode(m_username).c_str(), EncryptionHelper::Base64Encode(m_password).c_str()));
578577
authProgress++;
579578
//if (IsResponseGood(getUserRank)) {

Diff for: PrivateMenu/src/menu/submenus/main/sessionMenu.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ void SessionMenu::Update() {
344344

345345
/*Background update*/
346346
void SessionMenu::FeatureUpdate() {
347-
//Session::Tick();
347+
//Session::Tick(); //crush now
348348

349349
if (vars.showtalkingplayers)ShowTalkingPlayers();
350350
//if (vars.showotr)ShowOtrPlayers();

Diff for: PrivateMenu/src/menu/util/joaat.hpp

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#pragma once
2+
#include "stdafx.h"
3+
#include <string_view>
4+
#include <type_traits>
5+
/// <summary>
6+
/// copy from yimmenu but c++17
7+
/// </summary>
8+
namespace rage {
9+
using joaat_t = std::uint32_t;
10+
11+
inline constexpr char JoaatToLower(char c) {
12+
return (c >= 'A' && c <= 'Z') ? c + ('a' - 'A') : c;
13+
}
14+
15+
inline joaat_t joaat(std::string_view str) {
16+
joaat_t hash = 0;
17+
for (auto c : str)
18+
{
19+
hash += JoaatToLower(c);
20+
hash += (hash << 10);
21+
hash ^= (hash >> 6);
22+
}
23+
hash += (hash << 3);
24+
hash ^= (hash >> 11);
25+
hash += (hash << 15);
26+
return hash;
27+
}
28+
template<std::size_t N>
29+
constexpr joaat_t constexpr_joaat(const char(&data)[N])
30+
{
31+
joaat_t hash = 0;
32+
33+
for (std::size_t i = 0; i < N - 1; ++i)
34+
{
35+
hash += JoaatToLower(data[i]);
36+
hash += (hash << 10);
37+
hash ^= (hash >> 6);
38+
}
39+
40+
hash += (hash << 3);
41+
hash ^= (hash >> 11);
42+
hash += (hash << 15);
43+
44+
return hash;
45+
}
46+
static_assert(constexpr_joaat("test") == 0x3f75ccc1);
47+
}
48+
49+
#define RAGE_JOAAT_IMPL(str) (::rage::constexpr_joaat(str))
50+
#define RAGE_JOAAT(str) (std::integral_constant<rage::joaat_t, RAGE_JOAAT_IMPL(str)>::value)

Diff for: PrivateMenu/src/stdafx.h

+1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ constexpr size_t NUMOF(T(&)[N]) { return N; }
160160
#include "menu/util/socialclub.h"
161161
#include "menu/util/inventoryTypes.h"
162162
#include "menu/util/inventory.h"
163+
#include "menu/util/joaat.hpp"
163164

164165
/*Option*/
165166
#include "menu/options/option.h"

Diff for: PrivateMenu/src/util/systemData.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ bool SystemData::Initialize()
9494
// m_socialClubEmail = (char*)(GetAddressFromInstruction(data.m_address, 0x17));
9595
//})) return false;
9696

97+
9798
m_operatingSystem = "";
9899
m_CPUSpeed = "";
99100
m_CPUBrand = "";

0 commit comments

Comments
 (0)