phpnuxbill/system/autoload/Password.php

36 lines
799 B
PHP
Raw Normal View History

2017-03-11 03:51:06 +08:00
<?php
2021-11-08 20:56:30 +08:00
2017-03-11 03:51:06 +08:00
/**
2022-10-16 15:50:24 +08:00
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
2021-11-08 20:56:30 +08:00
**/
2017-03-11 03:51:06 +08:00
2021-11-08 20:56:30 +08:00
class Password
{
2017-03-11 03:51:06 +08:00
2021-11-08 20:56:30 +08:00
public static function _crypt($password)
{
return sha1($password);
2017-03-11 03:51:06 +08:00
}
2021-11-08 20:56:30 +08:00
public static function _verify($user_input, $hashed_password)
{
if (sha1($user_input) == $hashed_password) {
2017-03-11 03:51:06 +08:00
return true;
}
return false;
}
2021-11-08 20:56:30 +08:00
public static function _uverify($user_input, $hashed_password)
{
2017-03-11 03:51:06 +08:00
if ($user_input == $hashed_password) {
return true;
}
return false;
}
2021-11-08 20:56:30 +08:00
public static function _gen()
{
2017-03-11 03:51:06 +08:00
$pass = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@#!123456789', 8)), 0, 8);
return $pass;
}
2021-11-08 20:56:30 +08:00
}