Sample code for 30+ languages & platforms
Perl

Obfuscate String

Demonstrates how to obfuscate and unobfuscate a string.

Chilkat Perl Downloads

Perl
use chilkat();

$success = 0;

$sb = chilkat::CkStringBuilder->new();

$s = "Hello World!";

$sb->Append($s);
print $sb->getAsString() . "\r\n";

# Output is "Hello World!";

# Obfuscate the string.
# This is NOT encryption.  It's just a simple obfuscation.
$sb->Obfuscate();
print $sb->getAsString() . "\r\n";

# Output is 2GsgGhbSQVyG8Vb9

# -------------------------
# Unobfuscate.
$sb2 = chilkat::CkStringBuilder->new();
$s2 = "2GsgGhbSQVyG8Vb9";
$sb2->Append($s2);
$sb2->Unobfuscate();

print $sb2->getAsString() . "\r\n";

# Output is "Hello World!";