标签:function ret 使用 encode mode cti 实现 fun decrypt
// 加密 function encryptStr($str, $key){ $block = mcrypt_get_block_size(‘des‘, ‘ecb‘); $pad = $block - (strlen($str) % $block); $str .= str_repeat(chr($pad), $pad); $enc_str = mcrypt_encrypt(MCRYPT_DES, $key, $str, MCRYPT_MODE_ECB); return base64_encode($enc_str); } // 解密 function decryptStr($str, $key){ $str = base64_decode($str); $str = mcrypt_decrypt(MCRYPT_DES, $key, $str, MCRYPT_MODE_ECB); $block = mcrypt_get_block_size(‘des‘, ‘ecb‘); $pad = ord($str[($len = strlen($str)) - 1]); return substr($str, 0, strlen($str) - $pad); }
标签:function ret 使用 encode mode cti 实现 fun decrypt
原文地址:https://www.cnblogs.com/niuben/p/9277445.html