Change PHP min version
This commit is contained in:
parent
9933263dbb
commit
9a8cc16b5c
4 changed files with 5 additions and 35 deletions
|
@ -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) {
|
||||
|
|
|
@ -10,7 +10,7 @@ use RuntimeException;
|
|||
|
||||
class Install extends Page
|
||||
{
|
||||
const PHP_MIN = '5.6.12';
|
||||
const PHP_MIN = '7.2.0';
|
||||
|
||||
/**
|
||||
* Для MySQL
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6.12",
|
||||
"php": ">=7.2.0",
|
||||
"ext-gd": "*",
|
||||
"ext-mbstring": "*",
|
||||
"artoodetoo/dirk": "dev-visman",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue