mirror of
https://github.com/halpz/re3.git
synced 2024-12-25 18:05:27 +00:00
CKeyGen fixes
This commit is contained in:
parent
af09cb06f5
commit
de13141b68
|
@ -79,7 +79,7 @@ CKeyGen::GetKey(const char *str, int size)
|
||||||
{
|
{
|
||||||
uint32 key = 0xffffffff;
|
uint32 key = 0xffffffff;
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
key ^= keyTable[str[i]];
|
key = keyTable[(key ^ str[i]) & 0xFF] ^ (key >> 8);
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ CKeyGen::GetKey(const char *str)
|
||||||
{
|
{
|
||||||
uint32 key = 0xffffffff;
|
uint32 key = 0xffffffff;
|
||||||
while(*str != '\0')
|
while(*str != '\0')
|
||||||
key ^= keyTable[*(str++)];
|
key = keyTable[(key ^ *(str++)) & 0xFF] ^ (key >> 8);
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ CKeyGen::GetUppercaseKey(const char *str)
|
||||||
{
|
{
|
||||||
uint32 key = 0xffffffff;
|
uint32 key = 0xffffffff;
|
||||||
while (*str != '\0')
|
while (*str != '\0')
|
||||||
key ^= keyTable[toupper(*(str++))];
|
key = keyTable[(key ^ toupper(*(str++))) & 0xFF] ^ (key >> 8);
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +105,6 @@ uint32
|
||||||
CKeyGen::AppendStringToKey(uint32 key, const char *str)
|
CKeyGen::AppendStringToKey(uint32 key, const char *str)
|
||||||
{
|
{
|
||||||
while (*str != '\0')
|
while (*str != '\0')
|
||||||
key ^= keyTable[*(str++)];
|
key = keyTable[(key ^ *(str++)) & 0xFF] ^ (key >> 8);
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
Loading…
Reference in a new issue