mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 11:44:10 +09:00
Remove outdated checks for old PHP versions
This commit is contained in:
parent
1bf110439a
commit
a0d9e1c6ad
3 changed files with 7 additions and 21 deletions
|
|
@ -79,11 +79,11 @@ class Password
|
|||
public static function getSupportedAlgorithms()
|
||||
{
|
||||
$retval = array();
|
||||
if (version_compare(PHP_VERSION, '5.3.7', '>=') && defined('\CRYPT_BLOWFISH'))
|
||||
if (defined('\CRYPT_BLOWFISH'))
|
||||
{
|
||||
$retval['bcrypt'] = 'bcrypt';
|
||||
}
|
||||
if (function_exists('hash_hmac') && in_array('sha512', hash_algos()))
|
||||
if (in_array('sha512', hash_algos()))
|
||||
{
|
||||
$retval['pbkdf2'] = 'pbkdf2';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Security
|
|||
$key = substr(hash('sha256', $key, true), 0, 16);
|
||||
|
||||
// Use defuse/php-encryption if possible.
|
||||
if (!$force_compat && version_compare(\PHP_VERSION, '5.4.0', '>=') && function_exists('openssl_encrypt'))
|
||||
if (!$force_compat && function_exists('openssl_encrypt'))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -96,7 +96,7 @@ class Security
|
|||
}
|
||||
|
||||
// Use defuse/php-encryption if possible.
|
||||
if (!$force_compat && version_compare(\PHP_VERSION, '5.4.0', '>=') && function_exists('openssl_decrypt'))
|
||||
if (!$force_compat && function_exists('openssl_decrypt'))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -147,11 +147,11 @@ class Security
|
|||
{
|
||||
$entropy = random_bytes($entropy_capped_bytes);
|
||||
}
|
||||
elseif(function_exists('openssl_random_pseudo_bytes') && (!$is_windows || version_compare(\PHP_VERSION, '5.4', '>=')))
|
||||
elseif(function_exists('openssl_random_pseudo_bytes'))
|
||||
{
|
||||
$entropy = openssl_random_pseudo_bytes($entropy_capped_bytes);
|
||||
}
|
||||
elseif(function_exists('mcrypt_create_iv') && (!$is_windows || version_compare(\PHP_VERSION, '5.3.7', '>=')))
|
||||
elseif(function_exists('mcrypt_create_iv') && !$is_windows)
|
||||
{
|
||||
$entropy = mcrypt_create_iv($entropy_capped_bytes, \MCRYPT_DEV_URANDOM);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue