Perl
Chilkat2 Perl
Obfuscate String
Demonstrates how to obfuscate and unobfuscate a string.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
my $success = 0;
my $sb = Chilkat2::StringBuilder->new;
my $s = 'Hello World!';
$sb->Append($s);
print $sb->GetAsString(), "\n";
# Output is "Hello World!";
# Obfuscate the string.
# This is NOT encryption. It's just a simple obfuscation.
$sb->Obfuscate();
print $sb->GetAsString(), "\n";
# Output is 2GsgGhbSQVyG8Vb9
# -------------------------
# Unobfuscate.
my $sb2 = Chilkat2::StringBuilder->new;
my $s2 = '2GsgGhbSQVyG8Vb9';
$sb2->Append($s2);
$sb2->Unobfuscate();
print $sb2->GetAsString(), "\n";
# Output is "Hello World!";