feat: admin login
This commit is contained in:
42
app/Lib/Crypto/AdminPasswordCrypto.php
Normal file
42
app/Lib/Crypto/AdminPasswordCrypto.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Lib\Crypto;
|
||||
|
||||
use Exception;
|
||||
|
||||
class AdminPasswordCrypto implements CryptoInterface
|
||||
{
|
||||
/**
|
||||
* 明文密码
|
||||
* @var string
|
||||
*/
|
||||
public string $data = '';
|
||||
|
||||
/**
|
||||
* 加密盐
|
||||
* @var string
|
||||
*/
|
||||
public string $salt = '';
|
||||
|
||||
/**
|
||||
* admin password 加密
|
||||
* @return string
|
||||
*/
|
||||
public function encrypt(): string
|
||||
{
|
||||
try {
|
||||
return hash("sha256", $this->salt . hash("sha256", $this->salt . $this->data));
|
||||
} catch (Exception) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密 不需要解密
|
||||
* @return string
|
||||
*/
|
||||
public function decrypt(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user