所以,我有 4 件中的 3 件在工作,iOS 加密-解密由此而来Link http://iphonedevelopment.blogspot.com/2009/02/strong-encryption-for-cocoa-cocoa-touch.html我能够解密从 iOS 加密的数据,但在 PHP 端加密时遇到问题。
当我回显加密代码时。 PHP 打印类似 F>HFl8aR 的内容是什么意思?
SALTKEY = 'a16byteslongkey!';
解密代码:Working
$result = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, (SALTKEY . str_repeat(chr(0x00), 16)),
base64_decode($text), 'ecb');
$pad_char = ord(substr($result, -1));
return substr($result, 0, strlen($result) - $pad_char);
加密代码:不工作
$result = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, (SALTKEY . str_repeat(chr(0x00), 16)),
base64_encode($text), 'ecb');
$pad_char = ord(substr($result, -1));
return substr($result, 0, strlen($result) - $pad_char);