public function index() { $rawText = I('post.rawtext', ''); $text = I('post.text', ''); // dump(base64_encode("hebidu")); // dump(base64_decode("aGViaWR1")); // $privateKey = "hebidu"; // $iv = ""; // $string = "hebidu"; $key = "136799711"; // dump(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $privateKey, $string, MCRYPT_MODE_CBC, $iv)); //IOS AES 加密 //kCCOptionPKCS7Padding | kCCOptionECBMode, // $encodeStr = "uYjVy+FbJqXi/Ep+9OtaXA=="; //kCCOptionPKCS7Padding | kCCOptionECBMode, //uYjVy+FbJqXi/Ep+9OtaXA== $encodeStr = ""; if (IS_POST && (!empty($rawText) || !empty($text))) { if (!empty($rawText)) { dump($rawText); $encodeStr = AES::encrypt($rawText, $key); $this->assign("text", $encodeStr); dump($encodeStr); } else { dump($text); $encodeStr = AES::decrypt($text, $key); dump($encodeStr); $this->assign("rawtext", $encodeStr); } } // // $encode = AES::encrypt($string,$key); // dump($encode); // $encode = AES::decrypt($encode,$key); // dump($encode); $this->display(); // $encode="o83EVYqKiopZVlReXUw="; // $encode = $crypt->AESDecryptCtr($encode,$key,128); // dump($encode); // $encode="o83EVYqKiopZVlReXUw="; // $crypt = new Des(); // $encode = $crypt->encrypt($string,$key,true); // $decode = $crypt->decrypt($encode,$key,true); // echo $encode; // echo "<br />"; // echo $decode; // // $decode = $crypt->decrypt($encodeStr,$key,true); // echo "<br />"; // echo $decode; }