3v4l.org

run code in 300+ PHP versions simultaneously
<?php $r = new \Random\Randomizer(); $chars = 'abcdefghijklmnopqrstuvwxyz0123456789'; $lens = [10, 100, 1000, 1024 * 1024, 1024 * 1024 * 10]; // bcrypt foreach ($lens as $len) { $pw = $r->getBytesFromString($chars, $len); $time = microtime(true); password_hash($pw, PASSWORD_DEFAULT); echo microtime(true) - $time . ' ms (bcrypt ' . strlen($pw) . " chars)\n"; } // PBKDF2 foreach ($lens as $len) { $pw = $r->getBytesFromString($chars, $len); $time = microtime(true); hash_pbkdf2('sha256', $pw, 'salt', 100000); echo microtime(true) - $time . ' ms (PBKDF2 ' . strlen($pw) . " chars)\n"; } // SHA-1 $time = microtime(true); foreach ($lens as $len) { $pw = $r->getBytesFromString($chars, $len); $time = microtime(true); sha1($pw); echo microtime(true) - $time . ' ms (SHA-1 ' . strlen($pw) . " chars)\n"; }

preferences:
34.68 ms | 408 KiB | 5 Q