清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
php代码,php很多东西都是提供好的,直接用函数,但是php目前所知填充模式只有ZeroPadding,于是其他语言就只能跟着它来了:
<?php $privateKey = "1234567812345678"; $iv = "1234567812345678"; $data = "Test String"; //加密 $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $privateKey, $data, MCRYPT_MODE_CBC, $iv); echo($encrypted); echo '<br/>'; echo(base64_encode($encrypted)); echo '<br/>'; //解密 $encryptedData = base64_decode("2fbwW9+8vPId2/foafZq6Q=="); $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $privateKey, $encryptedData, MCRYPT_MODE_CBC, $iv); echo($decrypted); ?>