(Unicode C) Obfuscate String
Demonstrates how to obfuscate and unobfuscate a string.
#include <C_CkStringBuilderW.h>
void ChilkatSample(void)
{
HCkStringBuilderW sb;
BOOL success;
const wchar_t *s;
HCkStringBuilderW sb2;
const wchar_t *s2;
sb = CkStringBuilderW_Create();
s = L"Hello World!";
CkStringBuilderW_Append(sb,s);
wprintf(L"%s\n",CkStringBuilderW_getAsString(sb));
// Output is "Hello World!";
// Obfuscate the string.
// This is NOT encryption. It's just a simple obfuscation.
CkStringBuilderW_Obfuscate(sb);
wprintf(L"%s\n",CkStringBuilderW_getAsString(sb));
// Output is 2GsgGhbSQVyG8Vb9
// -------------------------
// Unobfuscate.
sb2 = CkStringBuilderW_Create();
s2 = L"2GsgGhbSQVyG8Vb9";
CkStringBuilderW_Append(sb2,s2);
CkStringBuilderW_Unobfuscate(sb2);
wprintf(L"%s\n",CkStringBuilderW_getAsString(sb2));
// Output is "Hello World!";
CkStringBuilderW_Dispose(sb);
CkStringBuilderW_Dispose(sb2);
}
|