Sample code for 30+ languages & platforms
Xbase++

Obfuscate String

Demonstrates how to obfuscate and unobfuscate a string.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oSb
LOCAL s
LOCAL oSb2
LOCAL cS2

nSuccess := 0

oSb := CreateObject("Chilkat.StringBuilder")

s := "Hello World!"

oSb:Append(s)
? oSb:GetAsString()

//  Output is "Hello World!";

//  Obfuscate the string.
//  This is NOT encryption.  It's just a simple obfuscation.
oSb:Obfuscate()
? oSb:GetAsString()

//  Output is 2GsgGhbSQVyG8Vb9

//  -------------------------
//  Unobfuscate.
oSb2 := CreateObject("Chilkat.StringBuilder")
cS2 := "2GsgGhbSQVyG8Vb9"
oSb2:Append(cS2)
oSb2:Unobfuscate()

? oSb2:GetAsString()

//  Output is "Hello World!";

oSb:destroy()
oSb2:destroy()