Sample code for 30+ languages & platforms
C#

Obfuscate String

Demonstrates how to obfuscate and unobfuscate a string.

Chilkat C# Downloads

C#
bool success = false;

Chilkat.StringBuilder sb = new Chilkat.StringBuilder();

string s = "Hello World!";

sb.Append(s);
Debug.WriteLine(sb.GetAsString());

//  Output is "Hello World!";

//  Obfuscate the string.
//  This is NOT encryption.  It's just a simple obfuscation.
sb.Obfuscate();
Debug.WriteLine(sb.GetAsString());

//  Output is 2GsgGhbSQVyG8Vb9

//  -------------------------
//  Unobfuscate.
Chilkat.StringBuilder sb2 = new Chilkat.StringBuilder();
string s2 = "2GsgGhbSQVyG8Vb9";
sb2.Append(s2);
sb2.Unobfuscate();

Debug.WriteLine(sb2.GetAsString());

//  Output is "Hello World!";