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 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 = ''; 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 ); // T = T(1) | T(2) | T(3) | ... | T(N) $t .= $last_block; } // 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.0120.00616.63
8.3.50.0090.00918.05
8.3.40.0140.00318.78
8.3.30.0040.01118.66
8.3.20.0040.00420.21
8.3.10.0040.00423.48
8.3.00.0050.00319.38
8.2.180.0150.00618.17
8.2.170.0140.00722.96
8.2.160.0090.00920.35
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0060.00317.25
8.2.110.0030.00721.03
8.2.100.0040.00717.91
8.2.90.0050.00219.14
8.2.80.0030.00617.97
8.2.70.0000.00817.63
8.2.60.0040.00417.91
8.2.50.0030.00618.07
8.2.40.0040.00419.40
8.2.30.0020.00520.75
8.2.20.0000.00817.75
8.2.10.0040.00418.05
8.2.00.0040.00418.18
8.1.270.0050.00323.85
8.1.260.0040.00426.35
8.1.250.0070.00728.09
8.1.240.0030.00621.31
8.1.230.0120.00019.11
8.1.220.0090.00017.74
8.1.210.0060.00318.77
8.1.200.0000.00917.25
8.1.190.0060.00317.35
8.1.180.0000.00818.10
8.1.170.0040.00419.08
8.1.160.0040.00421.97
8.1.150.0040.00418.84
8.1.140.0050.00319.51
8.1.130.0000.00717.64
8.1.120.0040.00417.41
8.1.110.0030.00517.36
8.1.100.0030.00517.42
8.1.90.0030.00417.43
8.1.80.0000.01017.46
8.1.70.0030.00317.44
8.1.60.0040.00717.45
8.1.50.0000.00817.37
8.1.40.0060.00317.36
8.1.30.0030.00617.64
8.1.20.0000.00717.64
8.1.10.0000.00717.53
8.1.00.0040.00417.36
8.0.300.0020.00518.77
8.0.290.0030.00516.63
8.0.280.0080.00018.43
8.0.270.0030.00317.11
8.0.260.0030.00317.24
8.0.250.0050.00317.01
8.0.240.0000.00816.95
8.0.230.0000.00717.03
8.0.220.0030.00316.97
8.0.210.0050.00317.03
8.0.200.0040.00416.87
8.0.190.0000.00817.06
8.0.180.0050.00216.98
8.0.170.0000.00817.04
8.0.160.0040.00416.96
8.0.150.0030.00416.96
8.0.140.0000.00816.91
8.0.130.0030.00313.35
8.0.120.0040.00416.98
8.0.110.0050.00216.88
8.0.100.0000.00816.84
8.0.90.0040.00417.07
8.0.80.0070.01016.96
8.0.70.0040.00417.01
8.0.60.0000.00816.79
8.0.50.0050.00316.82
8.0.30.0030.01417.01
8.0.20.0100.00917.40
8.0.10.0040.00416.80
8.0.00.0070.01116.90
7.4.330.0000.00615.08
7.4.320.0030.00316.39
7.4.300.0000.00616.58
7.4.290.0070.00016.62
7.4.280.0060.00316.52
7.4.270.0070.00016.51
7.4.260.0070.00016.47
7.4.250.0000.00816.35
7.4.240.0030.00416.57
7.4.230.0000.00716.38
7.4.220.0090.00916.60
7.4.210.0070.00716.55
7.4.200.0030.00316.38
7.4.160.0030.01316.52
7.4.150.0090.00917.40
7.4.140.0130.01317.86
7.4.130.0100.00816.57
7.4.120.0120.00616.66
7.4.110.0060.01216.66
7.4.100.0100.01016.59
7.4.90.0030.01316.59
7.4.80.0090.01219.39
7.4.70.0110.00516.69
7.4.60.0090.00916.68
7.4.50.0000.00916.20
7.4.40.0100.01316.54
7.4.30.0100.00716.71
7.4.00.0070.01114.77
7.3.330.0050.00013.30
7.3.320.0050.00013.43
7.3.310.0030.00316.44
7.3.300.0040.00416.48
7.3.290.0000.00616.31
7.3.280.0100.00716.43
7.3.270.0110.01117.40
7.3.260.0060.01216.74
7.3.250.0110.01016.54
7.3.240.0090.01116.50
7.3.230.0180.00316.57
7.3.210.0090.00916.54
7.3.200.0250.00216.43
7.3.190.0060.00916.43
7.3.180.0060.00916.46
7.3.170.0110.00516.48
7.3.160.0090.00816.49
7.3.120.0040.01214.67
7.3.110.0070.01014.80
7.3.100.0000.01514.89
7.3.90.0070.01014.94
7.3.80.0040.01114.93
7.3.70.0000.00914.78
7.3.60.0100.00714.92
7.3.50.0090.00314.98
7.3.40.0030.01014.96
7.3.30.0040.00414.94
7.3.20.0110.00416.70
7.3.10.0000.01116.75
7.3.00.0000.01216.70
7.2.330.0070.01316.52
7.2.320.0170.00716.81
7.2.310.0070.01016.82
7.2.300.0090.00916.81
7.2.290.0100.00716.69
7.2.250.0030.01014.97
7.2.240.0120.00615.41
7.2.230.0090.00615.12
7.2.220.0090.00615.18
7.2.210.0120.00615.02
7.2.200.0070.00715.14
7.2.190.0070.00714.90
7.2.180.0030.01015.07
7.2.170.0090.00914.83
7.2.160.0110.00415.17
7.2.150.0040.00716.98
7.2.140.0070.00316.98
7.2.130.0030.00916.77
7.2.120.0070.00716.96
7.2.110.0050.01016.74
7.2.100.0100.00716.94
7.2.90.0000.01216.77
7.2.80.0090.00616.99
7.2.70.0080.00816.96
7.2.60.0050.00816.94
7.2.50.0070.00416.99
7.2.40.0090.00317.05
7.2.30.0030.01017.00
7.2.20.0090.00617.06
7.2.10.0060.00617.08
7.2.00.0020.01118.09
7.1.330.0090.00615.55
7.1.320.0100.01015.53
7.1.310.0090.00015.98
7.1.300.0090.00915.76
7.1.290.0070.00715.98
7.1.280.0030.00715.83
7.1.270.0060.00915.86
7.1.260.0030.00915.58
7.1.250.0040.00815.66
7.1.240.0040.00715.73
7.1.230.0070.01115.78
7.1.220.0090.00615.84
7.1.210.0040.00415.71
7.1.200.0050.00715.84
7.1.190.0000.01516.04
7.1.180.0030.00915.97
7.1.170.0030.00615.88
7.1.160.0080.00315.88
7.1.150.0100.00715.79
7.1.140.0090.00615.89
7.1.130.0100.00315.99
7.1.120.0070.00315.73
7.1.110.0060.00915.63
7.1.100.0050.00716.92
7.1.90.0040.00415.66
7.1.80.0030.01015.86
7.1.70.0060.00516.31
7.1.60.0040.01217.70
7.1.50.0000.01216.31
7.1.40.0060.00615.88
7.1.30.0060.00615.45
7.1.20.0030.01015.46
7.1.10.0040.00715.89
7.1.00.0100.03719.10
7.0.330.0030.01015.43
7.0.320.0070.01115.45
7.0.310.0030.00915.46
7.0.300.0070.00415.25
7.0.290.0090.00615.40
7.0.280.0110.00315.18
7.0.270.0070.00715.57
7.0.260.0070.01015.49
7.0.250.0040.01115.52
7.0.240.0090.00015.56
7.0.230.0000.01215.58
7.0.220.0060.00915.68
7.0.210.0070.00715.53
7.0.200.0120.01215.18
7.0.190.0030.01515.60
7.0.180.0000.00815.64
7.0.170.0000.01215.24
7.0.160.0060.00315.29
7.0.150.0080.00415.53
7.0.140.0100.00515.50
7.0.130.0040.01315.62
7.0.120.0070.01115.32
7.0.110.0040.01415.53
7.0.100.0070.00715.51
7.0.90.0060.00315.51
7.0.80.0070.01015.39
7.0.70.0000.00915.27
7.0.60.0070.04217.79
7.0.50.0030.02316.75
7.0.40.0030.03616.88
7.0.30.0180.03816.82
7.0.20.0130.04216.92
7.0.10.0030.03916.91
7.0.00.0080.04716.79
5.6.400.0000.01414.39
5.6.390.0000.00914.17
5.6.380.0060.01014.09
5.6.370.0090.00314.26
5.6.360.0070.00414.65
5.6.350.0060.00614.55
5.6.340.0070.00714.71
5.6.330.0070.00314.32
5.6.320.0060.00914.43
5.6.310.0060.01214.39
5.6.300.0050.01114.32
5.6.290.0000.01714.34
5.6.280.0070.03517.69
5.6.270.0030.01414.38
5.6.260.0080.00514.65
5.6.250.0000.01414.04
5.6.240.0070.00714.41
5.6.230.0060.00314.17
5.6.220.0030.00614.48
5.6.210.0070.04417.53
5.6.200.0050.04616.35
5.6.190.0060.02517.40
5.6.180.0150.04417.24
5.6.170.0140.04917.40
5.6.160.0070.04617.48
5.6.150.0100.03816.43
5.6.140.0000.03416.30
5.6.130.0100.02016.34
5.6.120.0030.02817.77
5.6.110.0030.04617.67
5.6.100.0030.03717.57
5.6.90.0100.04317.88
5.6.80.0030.03517.44
5.6.70.0000.01714.19
5.6.60.0030.01414.34
5.6.50.0100.00714.48
5.6.40.0090.00614.53
5.6.30.0070.00714.32
5.6.20.0070.00714.37
5.6.10.0090.00914.30
5.6.00.0060.00614.41
5.5.380.0030.01214.14
5.5.370.0040.00714.50
5.5.360.0040.00814.13
5.5.350.0220.04217.23
5.5.340.0070.02516.09
5.5.330.0060.04317.29
5.5.320.0150.02717.30
5.5.310.0190.02417.24
5.5.300.0100.03916.08
5.5.290.0050.02616.04
5.5.280.0100.03517.60
5.5.270.0030.05117.51
5.5.260.0060.04517.48
5.5.250.0050.04417.59
5.5.240.0080.04117.22
5.5.230.0080.00814.13
5.5.220.0060.01014.04
5.5.210.0000.01214.23
5.5.200.0030.01414.33
5.5.190.0000.01314.35
5.5.180.0060.00314.48
5.5.170.0040.00814.38
5.5.160.0040.00814.21
5.5.150.0070.00714.52
5.5.140.0000.01514.16
5.5.130.0000.01114.15
5.5.120.0040.01114.20
5.5.110.0070.00314.13
5.5.100.0030.01014.09
5.5.90.0030.00713.98
5.5.80.0110.00414.25
5.5.70.0000.01314.58
5.5.60.0100.00313.94
5.5.50.0100.00314.38
5.5.40.0030.01014.14
5.5.30.0040.00713.76
5.5.20.0100.00314.10
5.5.10.0100.00313.97
5.5.00.0060.00614.16

preferences:
65.27 ms | 400 KiB | 5 Q