Skip to content

Commit 701116c

Browse files
Используем MD5 алгоритм для crypt()
1 parent c2ae3b4 commit 701116c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

bench.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function getCpuInfo($fireUpCpu = false)
237237

238238
/** ---------------------------------- Code for common variables, tune values -------------------------------------------- */
239239

240-
// Search most advanced algo for SALT
240+
// Search most common available algo for SALT
241241
// http://php.net/manual/ru/function.crypt.php example #3
242242
$cryptSalt = null;
243243
if (defined('CRYPT_STD_DES') && CRYPT_STD_DES == 1) {
@@ -252,6 +252,13 @@ function getCpuInfo($fireUpCpu = false)
252252
$cryptSalt = '$1$rasmusle$';
253253
$cryptAlgoName = 'MD5';
254254
}
255+
256+
/**
257+
* These are available since 5.3+
258+
* MD5 should be available to all versions.
259+
*/
260+
261+
/*
255262
if (defined('CRYPT_BLOWFISH') && CRYPT_BLOWFISH == 1) {
256263
$cryptSalt = '$2a$07$usesomesillystringforsalt$';
257264
$cryptAlgoName = 'BlowFish';
@@ -264,12 +271,17 @@ function getCpuInfo($fireUpCpu = false)
264271
$cryptSalt = '$6$rounds=5000$usesomesillystringforsalt$';
265272
$cryptAlgoName = 'Sha512';
266273
}
274+
*/
275+
276+
if ($cryptAlgoName != 'MD5' && $cryptAlgoName != 'default') {
277+
print("<pre>\n<<< WARNING >>>\nHashing algorithm MD5 not available for crypt() in this PHP build!\n It should be available in any PHP build.\n</pre>" . PHP_EOL);
278+
}
267279

268280

269281
$cpuInfo = getCpuInfo();
270282
// CPU throttling?
271283
if (abs($cpuInfo['mips'] - $cpuInfo['mhz']) > 400) {
272-
print("<pre>\n<<< WARNING >>>\nCPU is in powersaving mode? Set CPU governor to 'performance'!\nFire up CPU and recalculate MHz!\n</pre>" . PHP_EOL);
284+
print("<pre>\n<<< WARNING >>>\nCPU is in powersaving mode? Set CPU governor to 'performance'!\n Fire up CPU and recalculate MHz!\n</pre>" . PHP_EOL);
273285
$cpuInfo = getCpuInfo(true);
274286
}
275287

0 commit comments

Comments
 (0)