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); } print $digest_length; print $salt; // 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.70.0040.01116.75
8.3.60.0100.01016.60
8.3.50.0110.00921.99
8.3.40.0100.00318.70
8.3.30.0090.00618.84
8.3.20.0070.00020.20
8.3.10.0090.00023.54
8.3.00.0040.00419.26
8.2.190.0100.01016.58
8.2.180.0030.01618.46
8.2.170.0070.01122.96
8.2.160.0080.00320.13
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00417.50
8.2.110.0060.00322.25
8.2.100.0040.00717.80
8.2.90.0000.00819.15
8.2.80.0060.00317.97
8.2.70.0030.00517.62
8.2.60.0040.00418.04
8.2.50.0040.00418.07
8.2.40.0040.00419.29
8.2.30.0050.00220.55
8.2.20.0040.00417.66
8.2.10.0040.00418.13
8.2.00.0050.00318.11
8.1.280.0070.00725.92
8.1.270.0030.00624.66
8.1.260.0000.00826.35
8.1.250.0020.00528.09
8.1.240.0090.00022.53
8.1.230.0080.00317.64
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0000.01017.35
8.1.190.0040.00417.25
8.1.180.0040.00418.10
8.1.170.0000.00818.84
8.1.160.0000.00722.04
8.1.150.0000.00718.83
8.1.140.0050.00319.52
8.1.130.0000.00717.60
8.1.120.0040.00417.43
8.1.110.0030.00417.29
8.1.100.0040.00417.43
8.1.90.0000.00717.28
8.1.80.0000.00717.45
8.1.70.0000.00717.45
8.1.60.0080.00017.59
8.1.50.0090.00017.54
8.1.40.0000.01017.48
8.1.30.0000.00817.55
8.1.20.0000.00817.61
8.1.10.0040.00417.57
8.1.00.0040.00417.36
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00818.41
8.0.270.0050.00217.20
8.0.260.0030.00517.24
8.0.250.0040.00417.02
8.0.240.0040.00416.98
8.0.230.0030.00317.07
8.0.220.0000.00717.01
8.0.210.0000.00717.02
8.0.200.0060.00316.91
8.0.190.0050.00317.03
8.0.180.0040.00416.98
8.0.170.0040.00416.88
8.0.160.0040.00416.86
8.0.150.0000.00716.95
8.0.140.0030.00516.96
8.0.130.0050.00013.38
8.0.120.0000.00816.96
8.0.110.0040.00416.91
8.0.100.0040.00416.84
8.0.90.0040.00416.86
8.0.80.0060.00916.96
8.0.70.0050.00316.90
8.0.60.0040.00417.04
8.0.50.0030.00516.86
8.0.30.0130.00817.00
8.0.20.0130.00617.40
8.0.10.0000.00716.87
8.0.00.0070.01116.81
7.4.330.0030.00315.08
7.4.320.0060.00016.53
7.4.300.0030.00316.54
7.4.290.0030.00316.52
7.4.280.0040.00416.51
7.4.270.0030.00316.55
7.4.260.0080.00016.41
7.4.250.0040.00416.57
7.4.240.0040.00416.54
7.4.230.0000.00816.66
7.4.220.0120.00916.46
7.4.210.0070.00716.59
7.4.200.0000.00716.42
7.4.160.0000.01616.59
7.4.150.0040.01417.40
7.4.140.0090.01217.86
7.4.130.0100.00816.58
7.4.120.0120.01116.57
7.4.110.0090.00916.68
7.4.100.0130.01016.58
7.4.90.0100.00716.50
7.4.80.0070.01119.39
7.4.70.0080.00816.50
7.4.60.0100.00716.49
7.4.50.0000.00916.42
7.4.40.0150.00616.38
7.4.30.0070.01016.62
7.4.00.0060.00915.14
7.3.330.0020.00213.42
7.3.320.0000.00513.29
7.3.310.0030.00316.46
7.3.300.0030.00316.48
7.3.290.0030.00316.43
7.3.280.0090.01216.49
7.3.270.0140.00917.40
7.3.260.0180.00016.46
7.3.250.0110.00916.60
7.3.240.0120.00716.42
7.3.230.0060.01216.73
7.3.210.0100.01316.57
7.3.200.0120.00416.48
7.3.190.0090.00916.67
7.3.180.0100.00616.54
7.3.170.0100.00716.48
7.3.160.0090.00616.64
7.3.00.0040.00416.42
7.2.330.0030.01516.70
7.2.320.0110.00716.79
7.2.310.0060.01216.76
7.2.300.0090.00916.84
7.2.290.0140.00416.78
7.2.130.0040.00716.89
7.2.120.0060.00516.94
7.2.110.0100.00317.05
7.2.100.0000.01216.79
7.2.90.0130.00017.04
7.2.80.0070.00416.95
7.2.70.0130.00316.74
7.2.60.0090.00316.85
7.2.50.0060.00616.86
7.2.40.0070.00416.86
7.2.30.0110.00416.70
7.2.20.0070.00416.85
7.2.10.0040.01116.64
7.2.00.0030.01018.28
7.1.250.0030.00615.79
7.1.240.0060.00315.61
7.1.230.0030.00715.70
7.1.220.0030.00715.77
7.1.210.0000.00915.65
7.1.200.0030.00715.70
7.1.190.0120.00315.91
7.1.180.0000.01415.94
7.1.170.0100.00315.76
7.1.160.0090.00315.89
7.1.150.0030.00915.74
7.1.140.0030.00715.77
7.1.130.0030.00715.83
7.1.120.0030.01015.96
7.1.110.0000.00815.87
7.1.100.0020.00817.08
7.1.90.0040.00415.53
7.1.80.0040.00815.65
7.1.70.0030.00616.55
7.1.60.0030.01517.67
7.1.50.0080.00816.26
7.1.40.0030.00715.89
7.1.30.0000.01015.86
7.1.20.0000.00715.96
7.1.10.0060.00915.45
7.1.00.0030.04518.97
7.0.330.0030.00615.31
7.0.320.0030.00715.49
7.0.310.0000.01015.55
7.0.300.0060.00615.41
7.0.290.0060.00315.41
7.0.280.0030.00615.34
7.0.270.0090.00315.27
7.0.260.0030.00815.34
7.0.250.0060.00615.44
7.0.240.0060.00615.42
7.0.230.0070.00015.54
7.0.220.0000.00915.18
7.0.210.0000.01515.49
7.0.200.0220.00514.83
7.0.190.0000.01115.57
7.0.180.0040.00815.59
7.0.170.0030.00615.21
7.0.160.0100.00015.59
7.0.150.0030.00615.18
7.0.140.0060.00615.36
7.0.130.0090.00315.53
7.0.120.0100.00015.36
7.0.110.0000.00915.59
7.0.100.0060.00615.34
7.0.90.0030.00615.31
7.0.80.0070.00715.26
7.0.70.0000.00915.47
7.0.60.0050.04317.53
7.0.50.0020.04716.63
7.0.40.0050.03816.82
7.0.30.0050.02816.86
7.0.20.0250.02016.80
7.0.10.0090.04216.83
7.0.00.0020.03716.83
5.6.380.0070.00314.16
5.6.370.0100.00014.37
5.6.360.0050.00514.36
5.6.350.0030.01014.50
5.6.340.0030.00714.51
5.6.330.0060.00314.43
5.6.320.0060.00614.43
5.6.310.0070.00714.63
5.6.300.0040.00714.50
5.6.290.0040.00714.50
5.6.280.0060.03017.81
5.6.270.0000.01014.45
5.6.260.0030.00714.36
5.6.250.0030.01014.49
5.6.240.0040.00714.42
5.6.230.0000.00914.24
5.6.220.0030.00614.18
5.6.210.0020.04517.39
5.6.200.0050.03416.19
5.6.190.0110.03917.56
5.6.180.0220.03817.51
5.6.170.0150.02217.44
5.6.160.0120.03517.43
5.6.150.0000.04616.29
5.6.140.0060.02516.20
5.6.130.0100.02016.26
5.6.120.0070.04517.72
5.6.110.0140.04217.74
5.6.100.0050.04617.64
5.6.90.0080.04517.73
5.6.80.0070.04317.27
5.6.70.0000.00914.22
5.6.60.0100.00013.99
5.6.50.0000.01114.43
5.6.40.0000.00914.11
5.6.30.0040.01114.24
5.6.20.0070.00714.35
5.6.10.0100.00614.42
5.6.00.0130.00314.16
5.5.380.0030.00510.88
5.5.370.0100.00010.96
5.5.360.0000.00811.16
5.5.350.0120.02815.74
5.5.340.0060.02214.53
5.5.330.0030.04515.82
5.5.320.0060.02515.71
5.5.310.0150.04015.73
5.5.300.0090.04114.47
5.5.290.0040.03014.71
5.5.280.0080.04216.09
5.5.270.0050.03316.05
5.5.260.0000.03716.08
5.5.250.0070.03215.85
5.5.240.0100.03715.82
5.5.230.0040.00411.28
5.5.220.0030.00711.29
5.5.210.0000.00611.17
5.5.200.0040.00711.01
5.5.190.0040.00411.36
5.5.180.0030.00711.05
5.5.170.0100.00311.11
5.5.160.0060.00310.91
5.5.150.0070.00410.75
5.5.140.0030.00710.96
5.5.130.0090.00011.09
5.5.120.0050.00510.80
5.5.110.0000.00811.35
5.5.100.0000.00711.12
5.5.90.0030.00911.18
5.5.80.0000.00811.20
5.5.70.0030.00310.73
5.5.60.0030.00711.33
5.5.50.0030.00311.13
5.5.40.0050.00211.09
5.5.30.0040.00711.02
5.5.20.0040.00711.34
5.5.10.0060.00311.41
5.5.00.0000.01011.09

preferences:
48.63 ms | 401 KiB | 5 Q