富贵资源网 Design By www.hznty.com

内容:abcd
KEY:1234567890123456
加密后base64:T7UT2NQ1AFvR9unjA0wKWA==

function apiDataDecrypt($data, $key='') {
  $data = base64_decode($data);
  $pad = 16 - (strlen($data) % 16);
  $padData = $data . str_repeat(chr($pad), $pad);
  return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key,$padData, MCRYPT_MODE_ECB);
}    
}

直接附上解决方案吧

$key = '1234567890123456';
$content = 'T7UT2NQ1AFvR9unjA0wKWA==';
$desStr = decryptString($content,$key);
echo($desStr);

function decryptString($str,$key) {
  $str = base64_decode($str);
  $str = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $str, MCRYPT_MODE_ECB);  
  $block = mcrypt_get_block_size('rijndael_128', 'ecb');
  $pad = ord($str[($len = strlen($str)) - 1]);
  $len = strlen($str);
  $pad = ord($str[$len-1]);  
  return substr($str, 0, strlen($str) - $pad);
}

以上所述就是本文的全部内容了,希望大家能够喜欢。

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com