3v4l.org

run code in 300+ PHP versions simultaneously
<?php function hash_pbkdf2_reg($a = 'sha256', $password, $salt, $rounds = 5000, $key_length = 32, $raw_output = false) { // Derived key $dk = ''; // Create key for ($block=1; $block<=$key_length; $block++) { // Initial hash for this block $ib = $h = hash_hmac($a, $salt . pack('N', $block), $password, true); // Perform block iterations for ($i=1; $i<$rounds; $i++) { // XOR each iteration $ib ^= ($h = hash_hmac($a, $h, $password, true)); } // Append iterated block $dk .= $ib; } // Return derived key of correct length $key = substr($dk, 0, $key_length); return $raw_output ? $key : base64_encode($key); } $salt = '1234567890123456'; $iterations = 200000; $length = 256; $hash1 = hash_pbkdf2_reg('sha256', 'plnlrtfpijpuhqylxbgqiiyipieyxvfsavzgxbbcfusqkozwpngsyejqlmjsytrmd', $salt, $iterations, $length);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Optional parameter $a declared before required parameter $salt is implicitly treated as a required parameter in /in/uTKa2 on line 2
Process exited with code 137.
Output for 8.0.0 - 8.0.30
Deprecated: Required parameter $password follows optional parameter $a in /in/uTKa2 on line 2 Deprecated: Required parameter $salt follows optional parameter $a in /in/uTKa2 on line 2
Process exited with code 137.
Output for 5.1.2 - 5.1.6, 5.2.0 - 5.2.17, 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.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33

Process exited with code 137.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1
Fatal error: Call to undefined function hash_hmac() in /in/uTKa2 on line 11
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: hash_hmac() in /in/uTKa2 on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: hash_hmac() in /in/uTKa2 on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: hash_hmac() in /in/uTKa2 on line 11

preferences:
195.07 ms | 401 KiB | 312 Q