[saco] Implement K_EncodeString and K_DecodeString

This commit is contained in:
RD42 2023-11-13 20:29:50 +08:00
parent 1f282e9768
commit 00e6cad71b
2 changed files with 43 additions and 1 deletions

View File

@ -234,4 +234,43 @@ void Util_Base64Encode( char *cpInput, char *cpOutput )
return;
}
//----------------------------------------------------
//----------------------------------------------------
// 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;
}
//----------------------------------------------------

View File

@ -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);
//----------------------------------------------------