I am having one php function which encrypts the string using custom encryption. I am trying to decrypt the string using its reverse function but I am unable to do so. Here is the function which encrypts the string.
function encrypt($str)
{
$cReturn = "";
$newStr = trim($str);
$len = strlen($newStr);
$j =0;
for($i=0;$i<$len;$i++)
{
$j++;
$cTemp = substr($newStr,$i,1);
if(in_array($cTemp,range(1,9)))
{
$cTemp = chr(64 + intval($cTemp));
}
$cReturn.= chr(ord($cTemp) + $j);
}
return $cReturn;
}
What should be the reverse function of it? Please help me. Thanks in advance....