mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 14:37:29 +08:00
[saco] Implement K_EncodeString
and K_DecodeString
This commit is contained in:
parent
1f282e9768
commit
00e6cad71b
@ -235,3 +235,42 @@ void Util_Base64Encode( char *cpInput, char *cpOutput )
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
// Simple rotate right 3 character encoding for
|
||||
// hiding strings in the exe.
|
||||
|
||||
void K_EncodeString(char *szInput, char *szOutput)
|
||||
{
|
||||
char b;
|
||||
|
||||
while(*szInput) {
|
||||
b = *szInput;
|
||||
_asm mov bl, b
|
||||
_asm ror bl, 3
|
||||
_asm mov b, bl
|
||||
*szOutput = b;
|
||||
szInput++;
|
||||
szOutput++;
|
||||
}
|
||||
*szOutput = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
char * K_DecodeString(unsigned char *szInput)
|
||||
{
|
||||
char b;
|
||||
char *st = (char *)szInput;
|
||||
|
||||
while(*szInput) {
|
||||
b = *szInput;
|
||||
_asm mov bl, b
|
||||
_asm rol bl, 3
|
||||
_asm mov b, bl
|
||||
*szInput = b;
|
||||
szInput++;
|
||||
}
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
@ -9,4 +9,7 @@ char *Util_strrev(char *str);
|
||||
char * Util_itoa(int v, char *s, int r);
|
||||
void Util_Base64Encode( char *cpInput, char *cpOutput );
|
||||
|
||||
char * K_DecodeString(unsigned char *szInput);
|
||||
void K_EncodeString(char *szInput, char *szOutput);
|
||||
|
||||
//----------------------------------------------------
|
Loading…
Reference in New Issue
Block a user