Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,16 +11,23 @@
|
||||
namespace IPS\convert\Login;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use function defined;
|
||||
use function ord;
|
||||
use function strlen;
|
||||
use function strpos;
|
||||
use function substr;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class to facilitate private crypt hashing
|
||||
*/
|
||||
class _HashCryptPrivate
|
||||
class HashCryptPrivate
|
||||
{
|
||||
/**
|
||||
* Private crypt hashing
|
||||
@@ -35,12 +42,12 @@ class _HashCryptPrivate
|
||||
$output = '*';
|
||||
|
||||
// Check for correct hash
|
||||
if ( \substr( $setting, 0, 3 ) != '$H$' )
|
||||
if ( substr( $setting, 0, 3 ) != '$H$' )
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$count_log2 = \strpos( $itoa64, $setting[3] );
|
||||
$count_log2 = strpos( $itoa64, $setting[3] );
|
||||
|
||||
if ( $count_log2 < 7 || $count_log2 > 30 )
|
||||
{
|
||||
@@ -48,9 +55,9 @@ class _HashCryptPrivate
|
||||
}
|
||||
|
||||
$count = 1 << $count_log2;
|
||||
$salt = \substr( $setting, 4, 8 );
|
||||
$salt = substr( $setting, 4, 8 );
|
||||
|
||||
if ( \strlen($salt) != 8 )
|
||||
if ( strlen($salt) != 8 )
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
@@ -84,7 +91,7 @@ class _HashCryptPrivate
|
||||
while ( --$count );
|
||||
}
|
||||
|
||||
$output = \substr( $setting, 0, 12 );
|
||||
$output = substr( $setting, 0, 12 );
|
||||
$output .= $this->_hashEncode64( $hash, 16, $itoa64 );
|
||||
|
||||
return $output;
|
||||
@@ -105,12 +112,12 @@ class _HashCryptPrivate
|
||||
|
||||
do
|
||||
{
|
||||
$value = \ord( $input[$i++] );
|
||||
$value = ord( $input[$i++] );
|
||||
$output .= $itoa64[$value & 0x3f];
|
||||
|
||||
if ( $i < $count )
|
||||
{
|
||||
$value |= \ord($input[$i]) << 8;
|
||||
$value |= ord($input[$i]) << 8;
|
||||
}
|
||||
|
||||
$output .= $itoa64[($value >> 6) & 0x3f];
|
||||
@@ -122,7 +129,7 @@ class _HashCryptPrivate
|
||||
|
||||
if ( $i < $count )
|
||||
{
|
||||
$value |= \ord($input[$i]) << 16;
|
||||
$value |= ord($input[$i]) << 16;
|
||||
}
|
||||
|
||||
$output .= $itoa64[($value >> 12) & 0x3f];
|
||||
|
||||
Reference in new issue
Block a user