cxfoot/components/EncryptHelper.php
2023-10-27 14:25:12 +08:00

56 lines
1.1 KiB
PHP

<?php
/**
* @author Any
* @description KISS
* @date 2020-11-18
* @version 1.0.0
*
* _____LOG_____
*
*/
namespace app\components;
use Dten\DTencrypt;
class EncryptHelper
{
/**
* 数据加密
* @param string $data 待加密数据
* @param string $key 加密key
* return stirng $encrypted_data
*/
public static function encrypt($data, $key)
{
return DTencrypt::encrypt($data, $key);
}
/**
* 数据加密
* @param string $encrypted_data 已加密数据
* @param string $key 加密key
* return stirng $data
*/
public static function decrypt($encrypted_data, $key)
{
return DTencrypt::decrypt($encrypted_data, $key);
}
public static function encryptMobilePhone($mobile)
{
return $mobile;
$key = \Yii::$app->params['mobileEncryptKey'];
return self::encrypt($mobile, $key);
}
public static function decryptMobilePhone($mobile)
{
return $mobile;
$key = \Yii::$app->params['mobileEncryptKey'];
return self::decrypt($mobile, $key);
}
}