3v4l.org

run code in 300+ PHP versions simultaneously
<?php $salt = substr(str_replace('+', '.', base64_encode(sha1(microtime(true), true))), 0, 22); // 2a is the bcrypt algorithm selector, see http://php.net/crypt // 12 is the workload factor (around 300ms on my Core i7 machine), see http://php.net/crypt $hash = crypt('falcon', '$2a$12$' . $salt); // we can now use the generated hash as the argument to crypt(), since it too will contain $a2$12$... with a variation of the hash. No need to store the salt anymore, just the hash is enough! var_dump($hash == crypt('foo', $hash)); // true var_dump($hash == crypt('falcon', $hash)); // false
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.17 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
bool(false) bool(true)
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6, 5.2.0 - 5.2.17

Process exited with code 139.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/sqDcX on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
Warning: Wrong parameter count for sha1() in /in/sqDcX on line 3
Process exited with code 139.

preferences:
137.16 ms | 401 KiB | 205 Q