mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2025-08-04 02:04:53 +02:00
simplify Chap verify RadiusRest
This commit is contained in:
parent
e5ff8c5675
commit
f1a9ad6d63
2 changed files with 56 additions and 20 deletions
|
@ -32,4 +32,19 @@ class Password
|
|||
$pass = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@#!123456789', 8)), 0, 8);
|
||||
return $pass;
|
||||
}
|
||||
|
||||
/**
|
||||
* verify CHAP password
|
||||
* @param string $realPassword
|
||||
* @param string $CHAPassword
|
||||
* @param string $CHAPChallenge
|
||||
* @return bool
|
||||
*/
|
||||
public static function chap_verify($realPassword, $CHAPassword, $CHAPChallenge){
|
||||
$CHAPassword = substr($CHAPassword, 2);
|
||||
$chapid = substr($CHAPassword, 0, 2);
|
||||
$result = hex2bin($chapid) . $realPassword . hex2bin(substr($CHAPChallenge, 2));
|
||||
$response = $chapid . md5($result);
|
||||
return ($response != $CHAPassword);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue