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); } return $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.60.0110.00318.55
8.3.50.0160.00521.99
8.3.40.0130.00718.67
8.3.30.0000.01518.68
8.3.20.0040.00420.34
8.3.10.0030.00623.36
8.3.00.0080.00019.50
8.2.180.0110.00725.92
8.2.170.0110.00718.81
8.2.160.0000.01422.96
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00421.06
8.2.110.0070.00322.25
8.2.100.0060.00617.93
8.2.90.0030.00519.13
8.2.80.0030.00517.97
8.2.70.0030.00617.50
8.2.60.0080.00017.93
8.2.50.0040.00418.07
8.2.40.0040.00419.45
8.2.30.0020.00520.53
8.2.20.0000.00817.77
8.2.10.0040.00418.08
8.2.00.0000.00718.04
8.1.280.0170.00325.92
8.1.270.0080.00024.66
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0040.00422.53
8.1.230.0050.00517.64
8.1.220.0030.00517.74
8.1.210.0060.00318.77
8.1.200.0030.00717.23
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0040.00419.02
8.1.160.0040.00422.09
8.1.150.0050.00318.76
8.1.140.0030.00519.52
8.1.130.0070.00017.58
8.1.120.0070.00017.43
8.1.110.0070.00017.41
8.1.100.0000.00817.41
8.1.90.0000.00917.30
8.1.80.0040.00417.34
8.1.70.0000.00717.36
8.1.60.0050.00317.43
8.1.50.0030.00617.48
8.1.40.0090.00317.51
8.1.30.0040.00417.56
8.1.20.0040.00417.61
8.1.10.0000.00817.49
8.1.00.0050.00217.44
8.0.300.0000.00718.77
8.0.290.0080.00016.75
8.0.280.0070.00018.39
8.0.270.0070.00017.16
8.0.260.0060.00017.10
8.0.250.0060.00316.98
8.0.240.0000.00816.87
8.0.230.0040.00317.06
8.0.220.0030.00316.95
8.0.210.0040.00416.93
8.0.200.0030.00317.02
8.0.190.0040.00417.01
8.0.180.0070.00017.04
8.0.170.0000.00816.89
8.0.160.0080.00017.09
8.0.150.0050.00317.01
8.0.140.0040.00416.94
8.0.130.0060.00013.36
8.0.120.0030.00516.90
8.0.110.0050.00216.99
8.0.100.0040.00416.75
8.0.90.0070.00016.97
8.0.80.0090.00616.94
8.0.70.0070.00016.81
8.0.60.0000.00716.77
8.0.50.0000.00717.07
8.0.30.0090.00917.04
8.0.20.0090.01217.40
8.0.10.0040.00416.86
8.0.00.0070.01016.86
7.4.330.0060.00015.13
7.4.320.0000.00616.66
7.4.300.0000.00616.65
7.4.290.0000.00716.66
7.4.280.0040.00416.43
7.4.270.0000.00716.64
7.4.260.0000.00716.38
7.4.250.0050.00216.48
7.4.240.0050.00316.45
7.4.230.0050.00316.64
7.4.220.0060.01916.48
7.4.210.0040.01516.73
7.4.200.0030.00316.58
7.4.160.0060.01016.52
7.4.150.0150.00317.40
7.4.140.0070.01217.86
7.4.130.0040.01516.45
7.4.120.0160.00516.60
7.4.110.0160.00316.45
7.4.100.0130.01216.52
7.4.90.0140.00316.68
7.4.80.0070.01019.39
7.4.70.0090.00616.61
7.4.60.0190.00316.48
7.4.50.0040.00416.57
7.4.40.0110.00716.44
7.4.30.0060.01216.39
7.4.00.0060.00915.00
7.3.330.0030.00313.40
7.3.320.0000.00513.33
7.3.310.0030.00316.30
7.3.300.0070.00016.29
7.3.290.0030.00316.39
7.3.280.0080.00916.38
7.3.270.0090.00917.40
7.3.260.0070.01016.53
7.3.250.0120.01016.56
7.3.240.0070.01016.50
7.3.230.0060.01216.68
7.3.210.0130.00316.63
7.3.200.0130.00316.56
7.3.190.0180.00316.55
7.3.180.0060.00916.43
7.3.170.0060.01016.49
7.3.160.0070.00716.58
7.2.330.0120.00616.85
7.2.320.0030.01516.71
7.2.310.0120.00416.89
7.2.300.0150.00316.75
7.2.290.0120.00616.53
7.2.120.0330.00016.64
7.2.110.0040.00816.59
7.2.100.0210.00616.75
7.2.90.0120.00616.86
7.2.80.0170.00816.74
7.2.70.0240.01217.08
7.2.60.0170.00316.82
7.2.50.0120.00916.98
7.2.40.0200.00616.91
7.2.30.0260.00416.89
7.2.20.0210.00717.07
7.2.10.0250.00516.93
7.2.00.0130.00618.27
7.1.240.0230.00815.86
7.1.230.0220.00315.96
7.1.220.0120.00315.61
7.1.210.0210.00315.93
7.1.200.0110.00915.77
7.1.190.0250.00615.74
7.1.180.0150.01215.44
7.1.170.0210.00015.78
7.1.160.0210.00915.82
7.1.150.0190.00615.80
7.1.140.0260.00015.82
7.1.130.0110.01415.87
7.1.120.0140.01115.91
7.1.110.0080.00815.60
7.1.100.0160.00216.98
7.1.90.0150.01015.86
7.1.80.0210.00415.91
7.1.70.0090.00716.55
7.1.60.0120.01217.64
7.1.50.0130.01116.25
7.1.40.0140.00515.57
7.1.30.0290.00015.68
7.1.20.0200.00315.84
7.1.10.0170.00715.59
7.1.00.0190.04519.08
7.0.320.0120.01515.40
7.0.310.0160.01015.13
7.0.300.0150.00615.27
7.0.290.0120.00415.43
7.0.280.0260.00715.53
7.0.270.0210.00315.23
7.0.260.0160.00615.29
7.0.250.0150.00915.61
7.0.240.0180.00715.54
7.0.230.0550.00315.30
7.0.220.0100.00515.44
7.0.210.0110.01115.40
7.0.200.0490.00715.23
7.0.190.0340.00715.40
7.0.180.0150.00915.33
7.0.170.0210.00015.34
7.0.160.0120.00015.27
7.0.150.0110.01115.47
7.0.140.0220.00015.57
7.0.130.0190.00415.32
7.0.120.0310.00915.42
7.0.110.0130.01315.09
7.0.100.0290.00415.41
7.0.90.0210.00715.64
7.0.80.0180.00915.22
7.0.70.0180.01115.37
7.0.60.0110.04017.60
7.0.50.0240.03716.85
7.0.40.0160.03516.85
7.0.30.0110.04216.74
7.0.20.0150.04316.83
7.0.10.0080.04516.91
7.0.00.0120.03216.84
5.6.380.0120.00614.61
5.6.370.0070.01114.42
5.6.360.0100.00714.52
5.6.350.0080.00714.69
5.6.340.0150.00414.00
5.6.330.0130.00414.45
5.6.320.0080.00814.25
5.6.310.0150.00414.15
5.6.300.0100.00514.50
5.6.290.0100.00714.53
5.6.280.0080.03317.71
5.6.270.0090.00914.49
5.6.260.0110.00714.22
5.6.250.0080.00814.22
5.6.240.0130.00314.46
5.6.230.0070.00914.40
5.6.220.0060.01014.26
5.6.210.0130.03817.41
5.6.200.0090.04216.24
5.6.190.0080.04217.58
5.6.180.0170.03317.41
5.6.170.0180.04317.55
5.6.160.0080.03317.51
5.6.150.0100.04116.16
5.6.140.0100.02816.23
5.6.130.0050.04816.25
5.6.120.0090.04417.60
5.6.110.0140.03717.71
5.6.100.0100.04617.65
5.6.90.0130.04217.49
5.6.80.0110.03117.29
5.6.70.0070.00414.32
5.6.60.0070.01114.20
5.6.50.0100.00314.12
5.6.40.0080.00414.51
5.6.30.0090.00513.98
5.6.20.0060.01214.20
5.6.10.0120.00414.15
5.6.00.0090.01114.36
5.5.380.0030.00711.58
5.5.370.0120.00311.58
5.5.360.0100.00311.58
5.5.350.0080.02215.96
5.5.340.0140.03814.76
5.5.330.0070.04016.01
5.5.320.0200.02115.95
5.5.310.0200.03816.04
5.5.300.0070.02714.76
5.5.290.0050.04414.82
5.5.280.0090.04316.24
5.5.270.0120.03316.23
5.5.260.0090.04516.23
5.5.250.0050.03716.11
5.5.240.0070.04315.98
5.5.230.0070.00511.58
5.5.220.0060.00211.58
5.5.210.0080.00611.58
5.5.200.0030.00611.58
5.5.190.0120.00011.58
5.5.180.0080.00411.58
5.5.170.0110.00314.20
5.5.160.0040.01111.58
5.5.150.0070.00711.58
5.5.140.0070.00711.58
5.5.130.0130.00011.58
5.5.120.0040.00711.58
5.5.110.0040.01311.58
5.5.100.0030.00711.58
5.5.90.0110.00311.58
5.5.80.0040.00711.58
5.5.70.0060.00611.58
5.5.60.0100.00311.58
5.5.50.0080.00311.58
5.5.40.0030.00911.58
5.5.30.0110.00311.58
5.5.20.0030.00711.58
5.5.10.0000.00811.58
5.5.00.0070.00511.58

preferences:
61.74 ms | 401 KiB | 5 Q