Change PHP min version

This commit is contained in:
Visman 2020-05-24 20:31:05 +07:00
parent 9933263dbb
commit 9a8cc16b5c
4 changed files with 5 additions and 35 deletions

View file

@ -63,36 +63,6 @@ class Secury
return \hash_hmac($this->hmac['algo'], $data, $key . $this->hmac['salt']);
}
/**
* Возвращает случайный набор байтов заданной длины
*
* @param int $len
*
* @throws RuntimeException
*
* @return string
*/
public function randomKey(int $len): string
{
$key = '';
if (\function_exists('\\random_bytes')) {
$key .= (string) \random_bytes($len);
}
if (\strlen($key) < $len && \function_exists('\\mcrypt_create_iv')) {
$key .= (string) \mcrypt_create_iv($len, \MCRYPT_DEV_URANDOM);
}
if (\strlen($key) < $len && \function_exists('\\openssl_random_pseudo_bytes')) {
$tmp = (string) \openssl_random_pseudo_bytes($len, $strong);
if ($strong) {
$key .= $tmp;
}
}
if (\strlen($key) < $len) {
throw new RuntimeException('Could not gather sufficient random data');
}
return $key;
}
/**
* Возвращает случайную строку заданной длины состоящую из символов 0-9 и a-f
*
@ -102,7 +72,7 @@ class Secury
*/
public function randomHash(int $len): string
{
return \substr(\bin2hex($this->randomKey($len)), 0, $len);
return \substr(\bin2hex(\random_bytes($len)), 0, $len);
}
/**
@ -115,7 +85,7 @@ class Secury
*/
public function randomPass(int $len): string
{
$key = $this->randomKey($len);
$key = \random_bytes($len);
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
$result = '';
for ($i = 0; $i < $len; ++$i) {

View file

@ -10,7 +10,7 @@ use RuntimeException;
class Install extends Page
{
const PHP_MIN = '5.6.12';
const PHP_MIN = '7.2.0';
/**
* Для MySQL

View file

@ -24,7 +24,7 @@
}
],
"require": {
"php": ">=5.6.12",
"php": ">=7.2.0",
"ext-gd": "*",
"ext-mbstring": "*",
"artoodetoo/dirk": "dev-visman",

View file

@ -12,7 +12,7 @@ No: moderator functions, private messages, voting, subscriptions, rss, plugins/e
## Requirements
* PHP 5.6.12+ or 7.x.x
* PHP 7.2+
* A database such as MySQL 5.5.3 or later (_Drivers for other databases are not realized now_)
## Install