Sample code for 30+ languages & platforms
Tcl

Obfuscate String

Demonstrates how to obfuscate and unobfuscate a string.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set sb [new_CkStringBuilder]

set s "Hello World!"

CkStringBuilder_Append $sb $s
puts [CkStringBuilder_getAsString $sb]

# Output is "Hello World!";

# Obfuscate the string.
# This is NOT encryption.  It's just a simple obfuscation.
CkStringBuilder_Obfuscate $sb
puts [CkStringBuilder_getAsString $sb]

# Output is 2GsgGhbSQVyG8Vb9

# -------------------------
# Unobfuscate.
set sb2 [new_CkStringBuilder]

set s2 "2GsgGhbSQVyG8Vb9"
CkStringBuilder_Append $sb2 $s2
CkStringBuilder_Unobfuscate $sb2

puts [CkStringBuilder_getAsString $sb2]

# Output is "Hello World!";

delete_CkStringBuilder $sb
delete_CkStringBuilder $sb2