- base64_decode: documentation ( source)
- base64_encode: documentation ( source)
- json_encode: documentation ( source)
<?php
function xor_encrypt($in, $key) {
$outText = '';
// Iterate through each character
for($i=0;$i<strlen($in);$i++) {
$outText .= $in[$i] ^ $key[$i % strlen($key)];
}
return $outText;
}
$b64_decoded_cookie = base64_decode("ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSEV4sFxFeaAw%3D");
$defaultdata = array( "showpassword"=>"no", "bgcolor"=>"#ffffff");
$my_data_e = base64_encode(xor_encrypt(json_encode($defaultdata)));
$key = xor_encrypt(json_encode($defaultdata), $b64_decoded_cookie);
echo $key;
//echo $my_data_e;