已掉线,重新登录

首页 > 绿虎论坛 > 历史版块 > 编程 > PHP > 讨论/求助

标题: 这个php什么实现的、

作者: @Ta

时间: 2022-03-02发布,2022-03-02修改

点击: 1163
被下沉

aes.png
上图在这操作的:http://tool.chacuo.net/cryptaes

// php 这样操作也不对
var_dump(openssl_decrypt('8BC40C1D6A5DCEE56CB61B564400D5DB0A63B5F8AFA918338DA3234ED5CA328AA3D53D12BE8E9579BADFA05CC9AE36D2','AES-128-ECB','217BB3C10B1C3393',0,'0000000000000000'));

[隐藏样式|查看源码]


『回复列表(2|隐藏机器人聊天)』

1. https://m.php.cn/article/455991.html
这里有个解密的类,应该能给你点思路@大尨
(/@Ta/2022-03-02 20:35//)

2. @,感谢大佬,成功解密。

/**

 * @desc:php aes加密解密类

 * @author gl

 * @date 2019/08/31

 */

class CI_Aes{

    /**

     * CI_Aes cipher

     * @var string

     */

    protected $cipher = 'aes-128-ecb';

    /**

     * CI_Aes key

     *

     * @var string

     */

    protected $key;

    /**

     * CI_Aes constructor

     * @param string $key Configuration parameter

     */

 

    public function __construct($key=null){

        $this->key = $key;

    }

 

    /**

     * Initialize

     *

     * @param array $params Configuration parameters

     * @return CI_Encryption

     */

    public function initialize($params)

    {

        if (!empty($params) && is_array($params)) {

            foreach ($params as $key => $val) {

                $this->$key = $val;

            }

        }

    }

    /**

     * Encrypt

     *

     * @param string $data Input data

     * @return string

     */

    public function encrypt($data) {

        $endata =  openssl_encrypt($data, $this->cipher, $this->key, OPENSSL_RAW_DATA);

        return  bin2hex($endata);

    }

 

    /**

     * Decrypt

     *

     * @param string $data Encrypted data

     * @return string

     */

    public function decrypt($data) {

        $encrypted = hex2bin($data);

        return openssl_decrypt($encrypted, $this->cipher, $this->key, OPENSSL_RAW_DATA);

    }

 

}
(/@Ta/2022-03-02 22:22//)

回复需要登录

7月2日 00:57 星期三

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1