3v4l.org

run code in 300+ PHP versions simultaneously
<?php const CIPHER = MCRYPT_RIJNDAEL_128; const KEY_BYTE_SIZE = 16; const CIPHER_MODE = 'cbc'; const HASH_FUNCTION = 'sha256'; const MAC_BYTE_SIZE = 32; const ENCRYPTION_INFO = 'PIPS|KeyForEncryption'; const AUTHENTICATION_INFO = 'PIPS|KeyForAuthentication'; $key = base64_decode('wdmd3XIhnOAelom4Y8yPbw=='); $ekey = HKDF(HASH_FUNCTION, $key, KEY_BYTE_SIZE, ENCRYPTION_INFO); print "$ekey\n"; print urlsafe_b64encode($ekey); function urlsafe_b64encode($string) { $data = base64_encode($string); $data = str_replace(array('+','/','='),array('-','_',''),$data); return $data; } function HKDF($hash, $ikm, $length, $info = '', $salt = NULL) { // Find the correct digest length as quickly as we can. $digest_length = MAC_BYTE_SIZE; if ($hash != HASH_FUNCTION) { $digest_length = strlen(hash_hmac($hash, '', '', true)); } // Sanity-check the desired output length. if (empty($length) || !is_int($length) || $length < 0 || $length > 255 * $digest_length) { return CannotPerformOperationException(); } // "if [salt] not provided, is set to a string of HashLen zeroes." if (is_null($salt)) { $salt = str_repeat("\x00", $digest_length); } // HKDF-Extract: // PRK = HMAC-Hash(salt, IKM) // The salt is the HMAC key. $prk = hash_hmac($hash, $ikm, $salt, true); // HKDF-Expand: // This check is useless, but it serves as a reminder to the spec. if (strlen($prk) < $digest_length) { throw new CannotPerformOperationException(); } // T(0) = '' $t = ''; $last_block = ''; $record = ''; $iterations = 0; for ($block_index = 1; strlen($t) < $length; $block_index++) { // T(i) = HMAC-Hash(PRK, T(i-1) | info | 0x??) $last_block = hash_hmac( $hash, $last_block . $info . chr($block_index), $prk, true ); $record .= urlsafe_b64encode($last_block) . "\n"; $iterations++; // T = T(1) | T(2) | T(3) | ... | T(N) $t .= $last_block; } return $iterations; //return $record; // ORM = first L octets of T $orm = substr($t, 0, $length); if ($orm === FALSE) { throw new CannotPerformOperationException(); } return $orm; } ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0060.00916.63
8.3.50.0090.01122.03
8.3.40.0040.01118.57
8.3.30.0070.01118.71
8.3.20.0080.00020.29
8.3.10.0080.00023.66
8.3.00.0080.00019.50
8.2.180.0140.00718.31
8.2.170.0130.00322.96
8.2.160.0130.00320.52
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0060.00317.38
8.2.110.0060.00319.45
8.2.100.0060.00617.72
8.2.90.0040.00418.89
8.2.80.0030.00617.97
8.2.70.0000.00817.37
8.2.60.0060.00617.80
8.2.50.0050.00318.07
8.2.40.0000.00821.11
8.2.30.0000.00720.72
8.2.20.0080.00017.75
8.2.10.0040.00418.08
8.2.00.0040.00418.09
8.1.280.0140.00325.92
8.1.270.0060.00323.92
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00323.98
8.1.230.0000.01117.45
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0030.00617.23
8.1.190.0110.00017.22
8.1.180.0030.00518.10
8.1.170.0000.00718.88
8.1.160.0070.00021.96
8.1.150.0040.00418.79
8.1.140.0040.00419.56
8.1.130.0000.00717.65
8.1.120.0040.00417.34
8.1.110.0050.00317.43
8.1.100.0070.00017.35
8.1.90.0070.00017.27
8.1.80.0030.00517.34
8.1.70.0080.00017.48
8.1.60.0030.00517.55
8.1.50.0030.00717.51
8.1.40.0110.00017.50
8.1.30.0000.00817.57
8.1.20.0000.00717.59
8.1.10.0030.00617.44
8.1.00.0030.00617.50
8.0.300.0080.00018.77
8.0.290.0000.00816.88
8.0.280.0030.00318.43
8.0.270.0070.00017.32
8.0.260.0060.00017.15
8.0.250.0040.00416.99
8.0.240.0020.00516.92
8.0.230.0040.00317.03
8.0.220.0030.00316.94
8.0.210.0050.00216.98
8.0.200.0070.00016.91
8.0.190.0030.00616.95
8.0.180.0000.00816.91
8.0.170.0000.00717.00
8.0.160.0030.00317.07
8.0.150.0000.00716.94
8.0.140.0060.00316.81
8.0.130.0000.00613.46
8.0.120.0040.00416.86
8.0.110.0080.00016.92
8.0.100.0080.00017.04
8.0.90.0040.00416.89
8.0.80.0060.00916.95
8.0.70.0000.00716.95
8.0.60.0080.00016.89
8.0.50.0070.00016.93
8.0.30.0090.01117.12
8.0.20.0100.01117.40
8.0.10.0030.00517.06
8.0.00.0100.00716.72
7.4.330.0000.00515.08
7.4.320.0040.00416.45
7.4.300.0060.00016.52
7.4.290.0040.00416.64
7.4.280.0030.00616.63
7.4.270.0050.00316.65
7.4.260.0000.00716.56
7.4.250.0050.00316.40
7.4.240.0000.00716.61
7.4.230.0070.00016.57
7.4.220.0120.00916.63
7.4.210.0060.01016.48
7.4.200.0030.00316.67
7.4.160.0140.01016.38
7.4.150.0130.00617.40
7.4.140.0150.01117.86
7.4.130.0100.01016.65
7.4.120.0090.00916.50
7.4.110.0070.01616.70
7.4.100.0090.01316.63
7.4.90.0070.01416.54
7.4.80.0030.01419.39
7.4.70.0100.00616.47
7.4.60.0080.00816.66
7.4.50.0060.00016.55
7.4.40.0100.01016.68
7.4.30.0120.00916.56
7.4.10.0070.01116.51
7.4.00.0070.00915.79
7.3.330.0000.00513.33
7.3.320.0000.00613.33
7.3.310.0000.00716.46
7.3.300.0040.00416.46
7.3.290.0030.00416.48
7.3.280.0100.00816.46
7.3.270.0060.01217.40
7.3.260.0090.00916.37
7.3.250.0140.00616.50
7.3.240.0080.00916.70
7.3.230.0150.00716.54
7.3.210.0060.01216.58
7.3.200.0120.00916.69
7.3.190.0100.00716.45
7.3.180.0100.00716.50
7.3.170.0070.01016.69
7.3.160.0070.01016.54
7.3.130.0090.00616.38
7.3.120.0150.00316.34
7.3.110.0060.00916.59
7.3.100.0120.00316.50
7.3.90.0000.01416.45
7.3.80.0030.00916.30
7.3.70.0000.00816.39
7.3.60.0090.00616.44
7.3.50.0080.00616.22
7.3.40.0000.01116.31
7.3.30.0090.00616.49
7.3.20.0110.00418.04
7.3.10.0080.00318.13
7.3.00.0040.01118.02
7.2.330.0150.00616.71
7.2.320.0100.01316.52
7.2.310.0090.00616.51
7.2.300.0100.01316.82
7.2.290.0130.00616.61
7.2.260.0060.01316.57
7.2.250.0100.00616.35
7.2.240.0070.00716.43
7.2.230.0080.00816.54
7.2.220.0000.01016.73
7.2.210.0040.00716.64
7.2.200.0060.00316.43
7.2.190.0090.00916.48
7.2.180.0070.00316.37
7.2.170.0130.00316.68
7.2.160.0030.01016.55
7.2.150.0060.00918.29
7.2.140.0100.00318.59
7.2.130.0070.01118.52
7.2.120.0000.01018.28
7.2.110.0100.00318.52
7.2.100.0120.00618.53
7.2.90.0030.01018.39
7.2.80.0090.00618.58
7.2.70.0110.00418.45
7.2.60.0050.00917.71
7.2.50.0070.00718.56
7.2.40.0060.00618.39
7.2.30.0090.00918.50
7.2.20.0160.00318.34
7.2.10.0090.00918.45
7.2.00.0100.00818.98
7.1.330.0070.00717.54
7.1.320.0030.00617.32
7.1.310.0060.00617.53
7.1.300.0030.00917.36
7.1.290.0060.00617.36
7.1.280.0030.01017.38
7.1.270.0070.00717.34
7.1.260.0100.00317.32
7.1.250.0100.00617.55
7.1.240.0030.01017.23
7.1.230.0110.00617.16
7.1.220.0060.00817.22
7.1.210.0070.00717.15
7.1.200.0030.00716.60
7.1.190.0040.01117.30
7.1.180.0040.01417.16
7.1.170.0000.01317.34
7.1.160.0030.01017.18
7.1.150.0030.01217.27
7.1.140.0090.00617.32
7.1.130.0080.00717.40
7.1.120.0040.01217.05
7.1.110.0100.00717.35
7.1.100.0050.00917.67
7.1.90.0110.00717.36
7.1.80.0090.00617.47
7.1.70.0090.00417.22
7.1.60.0020.01618.35
7.1.50.0060.01317.15
7.1.40.0090.00617.34
7.1.30.0080.00917.32
7.1.20.0090.00617.17
7.1.10.0120.00417.35
7.1.00.0120.03319.75
7.0.330.0070.01017.06
7.0.320.0030.00717.06
7.0.310.0030.00617.10
7.0.300.0070.00716.89
7.0.290.0030.01717.11
7.0.280.0030.01716.98
7.0.270.0030.01316.80
7.0.260.0030.01217.01
7.0.250.0060.00916.69
7.0.240.0000.01517.07
7.0.230.0080.00516.88
7.0.220.0180.00017.02
7.0.210.0000.01817.15
7.0.200.0180.00615.70
7.0.190.0030.01016.98
7.0.180.0090.00617.03
7.0.170.0060.00617.00
7.0.160.0090.00916.89
7.0.150.0030.00916.88
7.0.140.0030.01017.02
7.0.130.0060.00917.01
7.0.120.0000.01017.20
7.0.110.0070.00717.11
7.0.100.0060.00616.99
7.0.90.0110.00017.09
7.0.80.0090.00917.17
7.0.70.0080.00616.95
7.0.60.0030.03818.54
7.0.50.0090.04217.40
7.0.40.0050.04217.50
7.0.30.0070.03717.58
7.0.20.0220.04517.51
7.0.10.0050.03517.63
7.0.00.0100.04017.60
5.6.400.0120.00015.75
5.6.390.0070.01015.93
5.6.380.0060.00615.66
5.6.370.0030.00715.95
5.6.360.0000.01016.00
5.6.350.0040.01215.67
5.6.340.0070.01316.07
5.6.330.0070.00715.99
5.6.320.0030.01415.98
5.6.310.0080.01216.02
5.6.300.0110.00615.82
5.6.290.0070.01416.06
5.6.280.0030.03718.49
5.6.270.0100.00615.74
5.6.260.0080.00415.82
5.6.250.0060.00615.77
5.6.240.0000.01215.83
5.6.230.0060.01215.99
5.6.220.0060.00615.88
5.6.210.0060.04618.25
5.6.200.0100.04717.03
5.6.190.0120.03318.30
5.6.180.0180.04018.25
5.6.170.0170.02918.19
5.6.160.0080.03318.33
5.6.150.0030.02617.10
5.6.140.0070.03317.17
5.6.130.0060.02317.03
5.6.120.0090.04718.49
5.6.110.0120.04318.43
5.6.100.0040.05018.43
5.6.90.0080.04718.50
5.6.80.0060.02318.13
5.6.70.0100.01015.75
5.6.60.0100.01015.68
5.6.50.0160.00015.80
5.6.40.0110.01116.02
5.6.30.0100.01315.74
5.6.20.0040.01116.04
5.6.10.0070.01015.89
5.6.00.0060.00615.92
5.5.380.0070.00715.83
5.5.370.0060.01115.59
5.5.360.0060.00615.79
5.5.350.0170.03118.14
5.5.340.0080.04216.75
5.5.330.0090.03018.07
5.5.320.0050.02418.04
5.5.310.0160.04018.13
5.5.300.0020.02916.88
5.5.290.0050.02516.86
5.5.280.0020.02918.36
5.5.270.0050.04718.28
5.5.260.0040.02718.28
5.5.250.0050.02718.19
5.5.240.0050.02817.92
5.5.230.0110.01115.67
5.5.220.0060.00315.73
5.5.210.0110.00715.63
5.5.200.0070.01015.84
5.5.190.0070.00715.59
5.5.180.0100.00715.53
5.5.170.0030.01015.79
5.5.160.0090.00915.47
5.5.150.0070.00315.87
5.5.140.0080.00615.61
5.5.130.0070.01315.73
5.5.120.0080.00815.91
5.5.110.0000.01215.80
5.5.100.0070.01015.80
5.5.90.0060.01315.77
5.5.80.0000.01515.82
5.5.70.0030.01315.63
5.5.60.0070.00715.74
5.5.50.0120.00615.33
5.5.40.0090.00615.79
5.5.30.0120.00415.65
5.5.20.0100.00715.77
5.5.10.0030.01315.70
5.5.00.0100.00715.59

preferences:
59.31 ms | 401 KiB | 5 Q