diff --git a/saco/runutil.cpp b/saco/runutil.cpp index 38d9e76..eb62cbf 100644 --- a/saco/runutil.cpp +++ b/saco/runutil.cpp @@ -234,4 +234,43 @@ void Util_Base64Encode( char *cpInput, char *cpOutput ) return; } -//---------------------------------------------------- \ No newline at end of file +//---------------------------------------------------- +// 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; +} + +//---------------------------------------------------- diff --git a/saco/runutil.h b/saco/runutil.h index dadb861..1ca751b 100644 --- a/saco/runutil.h +++ b/saco/runutil.h @@ -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); + //---------------------------------------------------- \ No newline at end of file