- json_decode: documentation ( source)
- base64_decode: documentation ( source)
- json_encode: documentation ( source)
<?php
$c1="ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSFl4sFxJeaAw=";
function xor_encrypt($in) {
$key = base64_decode($c1);
$text = $in;
$outText = '';
// Iterate through each character
for($i=0;$i<strlen($text);$i++) {
$outText .= $text[$i] ^ $key[$i % strlen($key)];
}
return $outText;
}
$defdata = array( "showpassword"=>"no", "bgcolor"=>"#00000");
print xor_encrypt(json_encode($defdata));
#decode
$tmp= json_decode(xor_encrypt($c2), true);
if (is_array($tmp)) {
print $tmp['showpassword'];
print $tmp['bgcolor'];
} else print "Error!";
print " <> ";
#encode
print xor_encrypt(json_encode($defdata));