delphi 异或加密 如何用PHP解密 如图

2025-03-20 23:39:57
推荐回答(1个)
回答1:

你看看下在的代码行不行 差不多这个意思了,如果有问题可以私信

function dec( $str )
{
    $XorKey = array(1,2,3,4,5,6,7,8); //这个应当是密钥
    $rt = '';
    $j = 0;
    for ($i=1; $i <= strlen($str) / 2; $i++)
    {
        $t = intval('0x'.substr($str, $i * 2 - 1, 2)) ^ $XorKey[$j];
        $rt = $rt . chr($t);
        $j = ($j + 1) % 8;
    }
    return $rt;
}
$ec = '12345678';
echo dec($ec);