<?php
namespace App\Common\Encrypt;
class DesEncrypt
{
private $key;
private $iv;
public function __construct($key, $iv)
{
$this->key = $key;
$this->iv = $iv;
}
public function decrypt($encrypted_data)
{
return openssl_decrypt(base64_decode($encrypted_data),'DES-EDE3-CBC',$this->key,OPENSSL_RAW_DATA,$this->iv);
}
public function encrypt($decrypted_data)
{
return base64_encode(openssl_encrypt($decrypted_data,'DES-EDE3-CBC',$this->key,OPENSSL_RAW_DATA,$this->iv));
}
}
PHP7——openssl函数加解密
最新推荐文章于 2023-05-07 11:24:27 发布