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 = ''; 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 .= chr($block_index) . urlsafe_b64encode($last_block) . "\n"; // T = T(1) | T(2) | T(3) | ... | T(N) $t .= $last_block; } 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.0140.00016.63
8.3.50.0110.01118.18
8.3.40.0110.00718.87
8.3.30.0120.00318.69
8.3.20.0050.00320.30
8.3.10.0060.00323.71
8.3.00.0030.00517.50
8.2.180.0120.00918.42
8.2.170.0030.01022.96
8.2.160.0090.00620.27
8.2.150.0080.00024.18
8.2.140.0090.00024.66
8.2.130.0050.00326.16
8.2.120.0040.00417.38
8.2.110.0030.00721.00
8.2.100.0040.00817.84
8.2.90.0000.00817.91
8.2.80.0060.00317.97
8.2.70.0100.00018.04
8.2.60.0030.00517.80
8.2.50.0040.00418.10
8.2.40.0040.00419.17
8.2.30.0030.00620.97
8.2.20.0050.00317.85
8.2.10.0040.00418.14
8.2.00.0040.00417.90
8.1.280.0090.01225.92
8.1.270.0050.00323.82
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0060.00323.95
8.1.230.0040.00721.04
8.1.220.0030.00517.74
8.1.210.0040.00419.03
8.1.200.0090.00317.35
8.1.190.0040.00417.23
8.1.180.0040.00718.10
8.1.170.0080.00018.71
8.1.160.0040.00418.86
8.1.150.0030.00620.74
8.1.140.0040.00419.54
8.1.130.0000.00717.53
8.1.120.0000.00717.32
8.1.110.0000.00817.43
8.1.100.0070.00017.31
8.1.90.0000.00817.43
8.1.80.0000.00817.39
8.1.70.0040.00417.28
8.1.60.0050.00317.52
8.1.50.0030.00817.51
8.1.40.0090.00317.50
8.1.30.0000.00817.57
8.1.20.0000.00717.61
8.1.10.0050.00317.57
8.1.00.0080.00017.34
8.0.300.0040.00419.77
8.0.290.0090.00016.63
8.0.280.0030.00318.46
8.0.270.0000.00817.15
8.0.260.0000.00617.13
8.0.250.0040.00416.89
8.0.240.0040.00416.90
8.0.230.0030.00316.96
8.0.220.0030.00516.88
8.0.210.0030.00516.82
8.0.200.0040.00416.89
8.0.190.0040.00416.95
8.0.180.0070.00016.92
8.0.170.0050.00316.86
8.0.160.0030.00416.95
8.0.150.0080.00016.92
8.0.140.0110.00216.90
8.0.130.0030.00313.38
8.0.120.0040.00416.98
8.0.110.0050.00316.89
8.0.100.0060.00316.84
8.0.90.0050.00217.01
8.0.80.0120.00916.95
8.0.70.0070.00016.98
8.0.60.0050.00217.04
8.0.50.0040.00416.88
8.0.30.0070.01117.18
8.0.20.0110.00817.40
8.0.10.0070.00017.17
8.0.00.0100.00716.84
7.4.330.0000.00615.08
7.4.320.0000.00716.46
7.4.300.0000.00616.69
7.4.290.0040.00416.61
7.4.280.0000.00816.62
7.4.270.0040.00416.68
7.4.260.0000.00816.46
7.4.250.0040.00416.48
7.4.240.0020.00516.53
7.4.230.0050.00216.66
7.4.220.0130.01316.55
7.4.210.0080.00616.60
7.4.200.0000.00816.52
7.4.160.0120.00616.79
7.4.150.0090.00917.40
7.4.140.0130.00817.86
7.4.130.0110.00716.48
7.4.120.0100.00816.57
7.4.110.0110.00816.67
7.4.100.0030.01916.61
7.4.90.0170.00016.52
7.4.80.0110.00719.39
7.4.70.0100.00716.74
7.4.60.0080.00816.57
7.4.50.0050.00316.35
7.4.40.0090.01216.62
7.4.30.0060.01016.53
7.4.00.0070.01014.95
7.3.330.0000.00513.39
7.3.320.0000.00513.33
7.3.310.0000.00716.36
7.3.300.0000.00716.30
7.3.290.0030.00316.45
7.3.280.0090.01116.47
7.3.270.0090.00917.40
7.3.260.0130.00316.79
7.3.250.0070.01216.44
7.3.240.0120.00816.56
7.3.230.0170.00016.57
7.3.210.0110.01116.34
7.3.200.0060.01216.59
7.3.190.0120.00416.40
7.3.180.0100.00716.52
7.3.170.0060.01616.74
7.3.160.0170.00016.43
7.3.120.0040.01514.89
7.3.110.0100.00614.75
7.3.100.0090.00615.00
7.3.90.0070.00715.16
7.3.80.0070.00715.21
7.3.70.0120.00415.03
7.3.60.0060.00914.94
7.3.50.0030.01314.96
7.3.40.0130.00314.82
7.3.30.0030.01014.77
7.3.20.0060.00916.82
7.3.10.0110.00316.74
7.3.00.0000.01616.77
7.2.330.0130.00416.76
7.2.320.0090.01516.75
7.2.310.0030.01316.88
7.2.300.0100.00816.77
7.2.290.0090.00916.73
7.2.250.0140.00415.28
7.2.240.0070.01014.85
7.2.230.0070.00315.37
7.2.220.0060.00315.30
7.2.210.0090.00915.13
7.2.200.0100.01015.16
7.2.190.0070.00315.28
7.2.180.0140.00314.93
7.2.170.0130.00715.29
7.2.110.0120.00416.71
7.2.100.0190.00416.40
7.2.90.0120.00316.59
7.2.80.0510.00616.66
7.2.70.0200.00017.01
7.2.60.0220.00516.87
7.2.50.0170.00317.05
7.2.40.0140.00317.00
7.2.30.0120.00616.81
7.2.20.0080.00816.95
7.2.10.0160.00317.13
7.2.00.0080.00617.94
7.1.330.0120.00415.63
7.1.320.0000.01015.81
7.1.310.0090.00615.85
7.1.300.0030.00715.78
7.1.290.0040.01115.64
7.1.280.0030.01315.82
7.1.270.0040.01115.61
7.1.260.0000.01616.02
7.1.230.0110.00715.86
7.1.220.0090.00315.50
7.1.210.0330.01215.60
7.1.200.0110.00215.74
7.1.190.0080.00415.49
7.1.180.0100.00515.96
7.1.170.0110.00415.88
7.1.160.0460.00415.79
7.1.150.0110.00615.77
7.1.140.0280.00415.89
7.1.130.0070.01415.86
7.1.120.0070.01115.47
7.1.110.0240.00715.67
7.1.100.0060.00816.95
7.1.90.0140.00315.89
7.1.80.0300.00915.73
7.1.70.0030.01016.42
7.1.60.0060.01117.78
7.1.50.0110.00616.30
7.1.40.0160.00316.11
7.1.30.0040.01515.82
7.1.20.0120.00315.85
7.1.10.0090.00315.70
7.1.00.0080.03819.09
7.0.310.0080.00815.51
7.0.300.0430.00015.42
7.0.290.0150.00315.39
7.0.280.0080.01115.44
7.0.270.0280.00315.22
7.0.260.0140.00315.36
7.0.250.0170.00015.42
7.0.240.0110.00515.35
7.0.230.0120.00415.21
7.0.220.0160.00515.61
7.0.210.0030.01015.28
7.0.200.0190.00715.12
7.0.190.0130.00315.57
7.0.180.0120.00415.29
7.0.170.0080.00815.46
7.0.160.0100.00715.30
7.0.150.0030.01015.46
7.0.140.0030.01415.18
7.0.130.0060.01015.30
7.0.120.0120.00315.64
7.0.110.0080.00815.55
7.0.100.0130.00415.41
7.0.90.0080.00415.41
7.0.80.0120.00415.48
7.0.70.0080.00715.05
7.0.60.0130.04617.69
7.0.50.0090.04216.79
7.0.40.0060.05016.84
7.0.30.0060.04616.83
7.0.20.0190.03816.84
7.0.10.0090.04616.71
7.0.00.0080.04216.83
5.6.380.0130.00314.37
5.6.370.0150.00014.65
5.6.360.0080.00814.59
5.6.350.0110.00514.57
5.6.340.0100.00814.35
5.6.330.0100.00714.65
5.6.320.0040.01114.27
5.6.310.0070.00714.57
5.6.300.0120.00414.50
5.6.290.0070.00714.11
5.6.280.0110.03417.66
5.6.270.0180.00314.33
5.6.260.0130.00314.05
5.6.250.0140.00014.29
5.6.240.0180.00314.15
5.6.230.0150.00014.54
5.6.220.0080.00414.44
5.6.210.0070.04317.47
5.6.200.0080.03616.35
5.6.190.0120.04317.39
5.6.180.0150.03517.53
5.6.170.0200.01817.67
5.6.160.0120.04317.48
5.6.150.0050.04616.33
5.6.140.0150.03816.35
5.6.130.0100.04216.34
5.6.120.0080.04517.68
5.6.110.0060.02717.62
5.6.100.0100.04517.61
5.6.90.0110.04217.72
5.6.80.0110.04017.42
5.6.70.0080.00814.43
5.6.60.0000.01514.59
5.6.50.0050.01014.20
5.6.40.0090.00414.57
5.6.30.0060.01014.57
5.6.20.0050.01114.23
5.6.10.0100.00614.51
5.6.00.0110.00714.11
5.5.380.0000.01112.79
5.5.370.0100.00312.79
5.5.360.0100.00212.79
5.5.350.0180.03816.57
5.5.340.0060.04415.38
5.5.330.0060.04616.52
5.5.320.0070.04316.55
5.5.310.0120.04616.56
5.5.300.0040.04415.43
5.5.290.0090.01815.37
5.5.280.0100.02316.84
5.5.270.0080.03016.83
5.5.260.0070.04016.85
5.5.250.0110.04416.68
5.5.240.0180.03716.58
5.5.230.0070.00512.79
5.5.220.0060.00312.79
5.5.210.0030.00912.79
5.5.200.0130.00012.79
5.5.190.0090.00512.79
5.5.180.0110.00412.79
5.5.170.0040.01414.43
5.5.160.0070.00712.79
5.5.150.0060.00612.79
5.5.140.0090.00312.79
5.5.130.0140.00412.79
5.5.120.0120.00012.79
5.5.110.0090.00612.79
5.5.100.0130.00312.79
5.5.90.0140.00012.79
5.5.80.0120.00012.79
5.5.70.0080.00512.79
5.5.60.0060.00912.79
5.5.50.0120.00012.79
5.5.40.0070.00712.79
5.5.30.0120.00312.79
5.5.20.0080.00412.79
5.5.10.0120.00012.79
5.5.00.0040.00712.79

preferences:
58.48 ms | 401 KiB | 5 Q