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); return strlen($prk); // 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.40.0110.00418.78
8.3.30.0110.00418.79
8.3.20.0040.00420.33
8.3.10.0090.00023.65
8.3.00.0060.00319.38
8.2.170.0140.00322.96
8.2.160.0180.00419.04
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00420.81
8.2.110.0030.00722.08
8.2.100.0080.00417.80
8.2.90.0000.00719.03
8.2.80.0090.00017.97
8.2.70.0080.00017.59
8.2.60.0040.00417.80
8.2.50.0040.00418.07
8.2.40.0060.00319.38
8.2.30.0040.00420.66
8.2.20.0050.00317.64
8.2.10.0040.00418.00
8.2.00.0070.00017.98
8.1.270.0000.00823.72
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00622.55
8.1.230.0040.00817.66
8.1.220.0050.00317.79
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0000.00817.25
8.1.180.0000.00818.10
8.1.170.0060.00318.96
8.1.160.0000.00821.94
8.1.150.0000.00818.75
8.1.140.0040.00419.54
8.1.130.0030.00317.45
8.1.120.0000.00817.41
8.1.110.0040.00417.36
8.1.100.0040.00417.35
8.1.90.0040.00417.41
8.1.80.0000.00817.38
8.1.70.0030.00317.30
8.1.60.0080.00017.54
8.1.50.0000.01117.50
8.1.40.0050.00417.47
8.1.30.0000.00817.50
8.1.20.0040.00417.60
8.1.10.0030.00617.44
8.1.00.0000.00917.35
8.0.300.0000.00718.77
8.0.290.0040.00416.63
8.0.280.0040.00418.32
8.0.270.0030.00317.09
8.0.260.0060.00316.92
8.0.250.0030.00316.90
8.0.240.0060.00316.92
8.0.230.0030.00316.91
8.0.220.0000.00716.95
8.0.210.0040.00316.83
8.0.200.0030.00517.00
8.0.190.0030.00617.01
8.0.180.0030.00317.09
8.0.170.0040.00416.89
8.0.160.0000.00716.83
8.0.150.0000.00716.89
8.0.140.0100.00316.96
8.0.130.0000.00613.39
8.0.120.0040.00416.94
8.0.110.0050.00216.99
8.0.100.0040.00417.09
8.0.90.0040.00416.85
8.0.80.0090.01316.89
8.0.70.0040.00416.80
8.0.60.0050.00217.09
8.0.50.0040.00416.96
8.0.30.0180.00217.08
8.0.20.0150.00917.40
8.0.10.0000.00716.85
8.0.00.0080.00916.77
7.4.330.0050.00015.08
7.4.320.0070.00016.54
7.4.300.0030.00316.68
7.4.290.0000.00716.55
7.4.280.0000.00716.54
7.4.270.0000.00716.63
7.4.260.0070.00016.52
7.4.250.0050.00216.40
7.4.240.0020.00516.60
7.4.230.0040.00416.66
7.4.220.0120.01116.49
7.4.210.0080.01216.58
7.4.200.0030.00316.72
7.4.160.0100.00716.70
7.4.150.0150.00317.40
7.4.140.0110.01017.86
7.4.130.0110.01016.58
7.4.120.0060.01416.67
7.4.110.0110.00616.60
7.4.100.0090.01616.59
7.4.90.0150.00616.43
7.4.80.0030.01419.39
7.4.70.0170.00716.71
7.4.60.0100.00716.42
7.4.50.0030.00616.59
7.4.40.0090.01216.48
7.4.30.0060.01516.51
7.4.10.0030.01614.98
7.4.00.0110.00714.61
7.3.330.0000.00613.25
7.3.320.0030.00313.46
7.3.310.0000.00716.50
7.3.300.0000.00716.32
7.3.290.0000.00716.32
7.3.280.0100.00816.46
7.3.270.0000.01817.40
7.3.260.0030.01416.41
7.3.250.0120.01016.57
7.3.240.0120.01316.42
7.3.230.0100.00716.50
7.3.210.0060.01616.61
7.3.200.0030.01316.46
7.3.190.0130.00616.43
7.3.180.0060.01016.55
7.3.170.0100.01016.48
7.3.160.0040.01116.61
7.3.130.0090.00614.82
7.3.120.0100.01014.93
7.3.110.0090.00614.82
7.3.100.0130.00314.82
7.3.90.0130.00714.84
7.3.80.0040.01114.54
7.3.70.0110.00014.59
7.3.60.0000.01514.53
7.3.50.0030.00714.43
7.3.40.0030.01014.58
7.3.30.0090.00614.73
7.3.20.0070.00316.42
7.3.10.0050.00516.05
7.3.00.0040.00416.53
7.2.330.0030.01416.50
7.2.320.0080.01116.87
7.2.310.0120.00416.68
7.2.300.0180.00316.50
7.2.290.0000.01816.86
7.2.260.0140.00715.07
7.2.250.0030.01714.63
7.2.240.0100.00715.16
7.2.230.0060.01215.19
7.2.220.0030.01415.00
7.2.210.0060.01315.28
7.2.200.0060.00614.77
7.2.190.0000.01215.13
7.2.180.0110.00414.98
7.2.170.0030.01214.94
7.2.160.0040.01114.97
7.2.150.0080.00816.63
7.2.140.0000.01416.46
7.2.130.0040.01116.75
7.2.120.0060.01016.61
7.2.110.0070.00716.60
7.2.100.0080.00317.10
7.2.90.0100.00316.70
7.2.80.0120.00316.38
7.2.70.0060.00916.68
7.2.60.0050.00916.91
7.2.50.0030.01016.83
7.2.40.0140.00016.77
7.2.30.0060.00616.56
7.2.20.0110.00716.76
7.2.10.0040.01116.74
7.2.00.0030.00918.27
7.1.330.0030.01315.64
7.1.320.0040.01315.95
7.1.310.0060.00315.34
7.1.300.0070.00715.49
7.1.290.0030.00615.66
7.1.280.0080.00415.65
7.1.270.0000.00915.43
7.1.260.0150.00015.38
7.1.250.0070.00415.73
7.1.240.0040.01115.55
7.1.230.0030.00615.62
7.1.220.0030.00715.69
7.1.210.0040.01115.54
7.1.200.0080.00615.76
7.1.190.0060.00315.83
7.1.180.0070.00715.70
7.1.170.0000.01515.20
7.1.160.0040.01115.67
7.1.150.0000.01115.43
7.1.140.0080.00815.64
7.1.130.0090.00315.77
7.1.120.0030.01315.66
7.1.110.0040.01115.86
7.1.100.0040.00816.88
7.1.90.0030.00815.61
7.1.80.0080.00415.91
7.1.70.0030.00816.42
7.1.60.0080.01217.51
7.1.50.0000.01516.38
7.1.40.0070.01015.69
7.1.30.0050.00515.41
7.1.20.0060.00615.75
7.1.10.0000.01415.71
7.1.00.0130.03519.01
7.0.330.0140.00315.25
7.0.320.0040.00815.18
7.0.310.0070.00415.46
7.0.300.0100.00615.00
7.0.290.0090.00015.18
7.0.280.0100.00315.52
7.0.270.0030.00615.38
7.0.260.0030.00915.34
7.0.250.0070.00715.44
7.0.240.0000.01715.27
7.0.230.0000.01015.16
7.0.220.0000.00815.30
7.0.210.0110.00014.99
7.0.200.0250.00314.79
7.0.190.0030.00915.49
7.0.180.0040.00415.43
7.0.170.0000.01215.22
7.0.160.0090.00315.32
7.0.150.0040.01115.15
7.0.140.0060.00615.49
7.0.130.0040.01115.02
7.0.120.0080.00815.13
7.0.110.0040.01415.09
7.0.100.0060.00915.18
7.0.90.0120.00615.36
7.0.80.0030.01415.13
7.0.70.0030.01315.39
7.0.60.0070.03717.58
7.0.50.0050.03816.56
7.0.40.0070.04716.79
7.0.30.0040.04916.86
7.0.20.0230.03016.80
7.0.10.0050.04816.78
7.0.00.0080.03016.63
5.6.400.0060.00914.20
5.6.390.0040.01114.19
5.6.380.0100.00413.86
5.6.370.0100.00714.04
5.6.360.0120.00314.54
5.6.350.0100.00314.09
5.6.340.0120.00414.32
5.6.330.0130.00014.08
5.6.320.0100.00714.09
5.6.310.0030.01014.45
5.6.300.0060.01013.75
5.6.290.0040.01114.41
5.6.280.0070.01517.71
5.6.270.0000.01614.57
5.6.260.0120.00614.35
5.6.250.0060.00914.11
5.6.240.0000.01214.28
5.6.230.0060.00914.39
5.6.220.0040.01114.16
5.6.210.0110.03917.62
5.6.200.0020.02616.19
5.6.190.0050.05117.52
5.6.180.0140.04217.39
5.6.170.0200.03517.43
5.6.160.0070.04317.29
5.6.150.0130.03716.15
5.6.140.0050.04316.34
5.6.130.0030.04116.10
5.6.120.0100.03817.63
5.6.110.0060.04617.51
5.6.100.0000.03517.68
5.6.90.0020.03017.62
5.6.80.0100.04517.40
5.6.70.0060.00313.96
5.6.60.0090.00914.11
5.6.50.0030.01013.99
5.6.40.0030.01314.30
5.6.30.0000.01714.21
5.6.20.0090.00614.31
5.6.10.0070.00714.28
5.6.00.0030.01013.85
5.5.380.0060.00614.11
5.5.370.0080.00814.25
5.5.360.0100.00613.89
5.5.350.0170.04717.24
5.5.340.0090.02216.10
5.5.330.0030.04717.44
5.5.320.0050.02317.11
5.5.310.0120.02717.39
5.5.300.0060.04116.29
5.5.290.0020.02616.10
5.5.280.0090.04017.47
5.5.270.0100.02817.55
5.5.260.0070.03617.56
5.5.250.0070.04317.22
5.5.240.0150.03017.19
5.5.230.0100.00314.36
5.5.220.0030.01014.26
5.5.210.0060.00813.87
5.5.200.0040.00814.18
5.5.190.0080.00814.22
5.5.180.0060.00314.40
5.5.170.0090.00314.21
5.5.160.0070.00714.36
5.5.150.0070.00714.33
5.5.140.0030.01014.28
5.5.130.0120.00014.21
5.5.120.0000.01113.92
5.5.110.0040.00814.18
5.5.100.0000.01014.11
5.5.90.0060.00614.05
5.5.80.0040.01114.34
5.5.70.0090.00614.09
5.5.60.0030.00614.08
5.5.50.0040.00413.57
5.5.40.0070.00714.02
5.5.30.0050.00514.41
5.5.20.0080.00414.08
5.5.10.0100.00014.18
5.5.00.0070.00313.95

preferences:
46.08 ms | 400 KiB | 5 Q