(PHP Extension) Obfuscate String
Demonstrates how to obfuscate and unobfuscate a string.
<?php
// The version number (9_5_0) should match version of the Chilkat extension used, omitting the micro-version number.
// For example, if using Chilkat v9.5.0.48, then include as shown here:
include("chilkat_9_5_0.php");
$sb = new CkStringBuilder();
$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.
$sb2 = new CkStringBuilder();
$s2 = '2GsgGhbSQVyG8Vb9';
$sb2->Append($s2);
$sb2->Unobfuscate();
print $sb2->getAsString() . "\n";
// Output is "Hello World!";
?>
|