3v4l.org

run code in 300+ PHP versions simultaneously
<?php function myhash(string $pwd): string { // Use md5 to make sure arbitrary length passwords are represented fully and not truncated. return password_hash(md5($pwd, true), PASSWORD_BCRYPT); } function myverify(string $pwd, string $hash): bool { return password_verify(md5($pwd, true), $hash); } var_dump(md5('mj'), md5('oq')); $hash = myhash('mj'); // Original password 'mj' is not the same as attack password 'oq', but they verify. var_dump(myverify('oq', $hash));
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.30, 8.0.0 - 8.0.20, 8.1.0 - 8.1.7
string(32) "007de96adfa8b36dc2c8dd268d039129" string(32) "0055c74f1290ce6b3a53db095bec1fbd" bool(true)

preferences:
96.31 ms | 402 KiB | 97 Q