MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / MPQHashCryptTable

Class MPQHashCryptTable

LuaSTGPlus/Dictionary.hpp:9–41  ·  view source on GitHub ↗

@brief MPQHash��

Source from the content-addressed store, hash-verified

7{
8 /// @brief MPQHash��
9 class MPQHashCryptTable
10 {
11 public:
12 static const MPQHashCryptTable& GetInstance()
13 {
14 static MPQHashCryptTable s_Table;
15 return s_Table;
16 }
17 private:
18 uint32_t m_CryptTable[0x500];
19 public:
20 uint32_t operator[](uint32_t idx)const
21 {
22 return m_CryptTable[idx];
23 }
24 public:
25 MPQHashCryptTable()
26 {
27 uint32_t seed = 0x00100001;
28 for (uint32_t index1 = 0; index1 < 0x100; index1++)
29 {
30 for (uint32_t index2 = index1, i = 0; i < 5; i++, index2 += 0x100)
31 {
32 unsigned long temp1, temp2;
33 seed = (seed * 125 + 3) % 0x2AAAAB;
34 temp1 = (seed & 0xFFFF) << 0x10;
35 seed = (seed * 125 + 3) % 0x2AAAAB;
36 temp2 = (seed & 0xFFFF);
37 m_CryptTable[index2] = (temp1 | temp2);
38 }
39 }
40 }
41 };
42
43 /// @brief MPQ Hash�㷨
44 template <uint32_t dwHashType>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected