bourse stock
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
717 B

2 months ago
<?php
namespace app\utility;
use Hashids\Hashids;
class UnqId
{
/**
* @desc 生成密码
* @param $string
* @param $salt
* @return string
*/
public function encryptPassword($string, $salt): string
{
if (empty($string)) {
return '';
}
$string = $salt.$string.$salt;
return md5(md5($string).$salt);
}
/**
* 校验密码是否正确
* @param $string
* @param $password
* @param $salt
* @return bool
*/
public function checkPassword($string, $password, $salt): bool
{
$encryptPassword = $this->encryptPassword($string, $salt);
return $encryptPassword == $password;
}
}