PHP Des加解密

<?php

namespace app\api\controller;

use think\Controller;

class Qrequest extends Controller
{
    public static $key = '這裏寫md5後的密文';

    /**
     * 加密文本
     * @param $content
     * @return string
     */
    public static function Encode($content)
    {
        $aes = new Des();
        $encrypted = $aes->DesEncrypt(base64_encode($content),self::$key);
        return $encrypted;
    }

    /**
     * 解密文本
     * @param $content
     * @return string
     */
    public static function Decode($content)
    {
        $aes = new Des();
        $decrypted = $aes->DesDecrypt($content,self::$key);
        return $decrypted;
    }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章