Sample code for 30+ languages & platforms
Unicode C++

Obfuscate String

Demonstrates how to obfuscate and unobfuscate a string.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkStringBuilderW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkStringBuilderW sb;

    const wchar_t *s = L"Hello World!";

    sb.Append(s);
    wprintf(L"%s\n",sb.getAsString());

    //  Output is "Hello World!";

    //  Obfuscate the string.
    //  This is NOT encryption.  It's just a simple obfuscation.
    sb.Obfuscate();
    wprintf(L"%s\n",sb.getAsString());

    //  Output is 2GsgGhbSQVyG8Vb9

    //  -------------------------
    //  Unobfuscate.
    CkStringBuilderW sb2;
    const wchar_t *s2 = L"2GsgGhbSQVyG8Vb9";
    sb2.Append(s2);
    sb2.Unobfuscate();

    wprintf(L"%s\n",sb2.getAsString());

    //  Output is "Hello World!";
    }