[PHP] Code
<?php//blog.qita.infunction Passport_encrypt ($txt, $key) {srand (double) microtime () * 1000000); $encrypt _key = MD5 ( Rand (0, 32000)); $ctr = 0; $tmp = "; for ($i = 0; $i < strlen ($txt); $i + +) {$ctr = $ctr = = strlen ($encrypt _key)? 0: $ctr; $tmp. = $encrypt _key[$ctr]. ( $txt [$i] ^ $encrypt _key[$ctr + +]); } return Base64_encode (Passport_key ($tmp, $key)); }function Passport_decrypt ($txt, $key) {$txt = Passport_key (Base64_decode ($txt), $key); $tmp = "; for ($i = 0; $i < str Len ($txt); $i + +) {$MD 5 = $txt [$i]; $tmp. = $txt [+ + $i] ^ $md 5;} return $tmp; }function Passport_key ($txt, $encrypt _key) {$encrypt _key = MD5 ($encrypt _key); $ctr = 0; $tmp = "; for ($i = 0; $i < St Rlen ($txt); $i + +) {$ctr = $ctr = = strlen ($encrypt _key)? 0: $ctr, $tmp. = $txt [$i] ^ $encrypt _key[$ctr + +];} return $tmp; }?>
PHP Cryptographic decryption function