登 录
代码地址
http://www.phpaes.com
经验证,和cpp得到的加密串一致。
aes,选择ecb模式
使用例子
<?php include("./AES.class.php"); $z = "abcdefgh01234567"; // 128-bit key //$z = "abcdefghijkl012345678901"; // 192-bit key //$z = "abcdefghijuklmno0123456789012345"; // 256-bit key $aes = new AES($z); //$data = file_get_contents("./example.txt"); //$data = 'hellohellohellohellohello'; $data = 'hello'; $data = app_get_sessionkey(111,222); $start = microtime(true); echo "/n/nkey:/n" . $z. "/n"; echo "/n/nCipher-Text:/n" . bin2hex($aes->encrypt($data)) . "/n"; echo "/n/nPlain-Text:/n" . $aes->decrypt($aes->encrypt($data)) . "/n"; $end = microtime(true); echo "/n/nExecution time: " . ($end - $start); function app_get_sessionkey($appId, $channelId) { $ret = Array( 'appId' => $appId ,'channelId' => $channelId ,'time' => time()
); $ret = json_encode($ret); return $ret; }
抱歉!评论已关闭.