18 lines
434 B
PHP
18 lines
434 B
PHP
<?php
|
|
|
|
namespace app\controller;
|
|
|
|
class Aes
|
|
{
|
|
public function encrypt($input)
|
|
{
|
|
return base64_encode(openssl_encrypt($input, 'AES-128-CBC', config('hard.DataSecret'), OPENSSL_RAW_DATA, config('hard.DataSecretIV')));
|
|
}
|
|
|
|
public function decrypt($input)
|
|
{
|
|
return openssl_decrypt(base64_decode($input), 'AES-128-CBC', config('hard.DataSecret'), OPENSSL_RAW_DATA, config('hard.DataSecretIV'));
|
|
}
|
|
|
|
|
|
} |