@ 2018-06-19T08:59:22Z <?php
$password = 'dupa123';
$salt = 'abcabcabcabcabcabcabca';
$cost = 12;
$hashWithManualSalt = password_hash($password, PASSWORD_BCRYPT, ['salt' => $salt, 'cost' => 12]);
$hashWithAutomaticSalt = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]);
echo 'deprecated way (should be valid): ', password_hash('dupa123', PASSWORD_BCRYPT, ['salt' => $salt, 'cost' => 12]) === $hashWithManualSalt ? 'valid' : 'invalid', PHP_EOL;
echo 'deprecated way (should be invalid): ', password_hash('dupa321', PASSWORD_BCRYPT, ['salt' => $salt, 'cost' => 12]) === $hashWithManualSalt ? 'valid' : 'invalid', PHP_EOL;
echo 'new way (should be valid): ', password_verify('dupa123', $hashWithAutomaticSalt) ? 'valid' : 'invalid', PHP_EOL;
echo 'new way (should be invalid): ', password_verify('dupa321', $hashWithAutomaticSalt) ? 'valid' : 'invalid', PHP_EOL;
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 7.2.6 0.019 2.050 16.55 7.2.5 0.032 1.682 14.75 7.2.4 0.036 2.047 14.88 7.2.3 0.051 2.002 14.99 7.2.2 0.047 2.057 14.97 7.2.1 0.038 2.073 14.67 7.2.0 0.025 2.096 15.08 7.1.17 0.047 1.859 13.92 7.1.16 0.035 2.071 13.53 7.1.15 0.019 2.106 13.65 7.1.14 0.033 2.073 13.83 7.1.13 0.025 2.031 13.85 7.1.12 0.048 2.088 13.88 7.1.11 0.035 1.984 13.76 7.1.10 0.070 1.578 13.69
preferences:dark mode live preview
37.15 ms | 400 KiB | 5 Q