3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 - 7.1.0
bool(false) bool(true)
Output for 5.0.0 - 5.0.5, 5.1.1 - 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.4.9
Warning: Wrong parameter count for sha1() in /in/sqDcX on line 3
Process exited with code 139.