mitrobill/system/autoload/Password.php

40 lines
930 B
PHP
Raw Normal View History

2017-03-11 02:51:06 +07:00
<?php
2021-11-08 19:56:30 +07:00
2017-03-11 02:51:06 +07:00
/**
2021-11-08 19:56:30 +07:00
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
2021-11-08 19:56:30 +07:00
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
* @license GNU General Public License version 2 or later; see LICENSE.txt
2021-11-08 19:56:30 +07:00
**/
2017-03-11 02:51:06 +07:00
2021-11-08 19:56:30 +07:00
class Password
{
2017-03-11 02:51:06 +07:00
2021-11-08 19:56:30 +07:00
public static function _crypt($password)
{
return sha1($password);
2017-03-11 02:51:06 +07:00
}
2021-11-08 19:56:30 +07:00
public static function _verify($user_input, $hashed_password)
{
if (sha1($user_input) == $hashed_password) {
2017-03-11 02:51:06 +07:00
return true;
}
return false;
}
2021-11-08 19:56:30 +07:00
public static function _uverify($user_input, $hashed_password)
{
2017-03-11 02:51:06 +07:00
if ($user_input == $hashed_password) {
return true;
}
return false;
}
2021-11-08 19:56:30 +07:00
public static function _gen()
{
2017-03-11 02:51:06 +07:00
$pass = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@#!123456789', 8)), 0, 8);
return $pass;
}
2021-11-08 19:56:30 +07:00
}