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 .= 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.0110.00316.75
8.3.50.0040.01522.03
8.3.40.0180.00018.68
8.3.30.0100.00718.67
8.3.20.0050.00320.07
8.3.10.0080.00023.53
8.3.00.0040.00419.14
8.2.180.0150.00618.25
8.2.170.0030.01022.96
8.2.160.0100.00320.35
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0090.00026.16
8.2.120.0090.00017.50
8.2.110.0040.00719.33
8.2.100.0120.00017.72
8.2.90.0030.00619.23
8.2.80.0030.00617.97
8.2.70.0070.00317.63
8.2.60.0060.00317.91
8.2.50.0040.00418.07
8.2.40.0030.00521.15
8.2.30.0080.00020.79
8.2.20.0000.00817.77
8.2.10.0000.00818.19
8.2.00.0000.00718.12
8.1.280.0140.00725.92
8.1.270.0000.00823.82
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00321.36
8.1.230.0080.00417.42
8.1.220.0060.00317.74
8.1.210.0000.00818.77
8.1.200.0030.00617.11
8.1.190.0110.00318.89
8.1.180.0030.00518.10
8.1.170.0070.00018.83
8.1.160.0040.00422.03
8.1.150.0050.00218.79
8.1.140.0000.00719.51
8.1.130.0040.00417.68
8.1.120.0000.00717.43
8.1.110.0040.00417.43
8.1.100.0000.00717.31
8.1.90.0000.00717.32
8.1.80.0000.00717.39
8.1.70.0030.00317.49
8.1.60.0000.00817.52
8.1.50.0100.00317.53
8.1.40.0040.00717.54
8.1.30.0050.00317.65
8.1.20.0070.00017.63
8.1.10.0000.00717.59
8.1.00.0030.00617.34
8.0.300.0000.00718.77
8.0.290.0040.00416.75
8.0.280.0040.00418.33
8.0.270.0070.00017.17
8.0.260.0030.00317.11
8.0.250.0040.00417.04
8.0.240.0040.00416.91
8.0.230.0000.00717.04
8.0.220.0040.00417.02
8.0.210.0070.00016.95
8.0.200.0040.00417.06
8.0.190.0040.00417.06
8.0.180.0040.00416.97
8.0.170.0070.00016.96
8.0.160.0040.00417.10
8.0.150.0080.00016.89
8.0.140.0090.00316.82
8.0.130.0000.00613.42
8.0.120.0000.00816.86
8.0.110.0040.00416.90
8.0.100.0000.00716.98
8.0.90.0070.00016.95
8.0.80.0100.00616.97
8.0.70.0000.00816.95
8.0.60.0000.00716.99
8.0.50.0040.00416.89
8.0.30.0090.01217.15
8.0.20.0120.00717.40
8.0.10.0000.00716.93
8.0.00.0090.00816.68
7.4.330.0030.00315.14
7.4.320.0040.00416.44
7.4.300.0000.00616.53
7.4.290.0000.00716.45
7.4.280.0080.00016.62
7.4.270.0030.00316.52
7.4.260.0040.00416.56
7.4.250.0080.00016.49
7.4.240.0020.00616.49
7.4.230.0040.00416.71
7.4.220.0090.00916.66
7.4.210.0090.00816.66
7.4.200.0000.00716.64
7.4.160.0090.00916.41
7.4.150.0140.00317.40
7.4.140.0110.00917.86
7.4.130.0050.01316.53
7.4.120.0100.00716.57
7.4.110.0070.01116.75
7.4.100.0130.00616.68
7.4.90.0150.00616.62
7.4.80.0090.00819.39
7.4.70.0120.00416.48
7.4.60.0030.01316.68
7.4.50.0000.00816.53
7.4.40.0110.00816.54
7.4.30.0100.00716.21
7.4.10.0070.01115.13
7.4.00.0050.01214.94
7.3.330.0000.00513.33
7.3.320.0030.00313.30
7.3.310.0000.00816.42
7.3.300.0030.00316.32
7.3.290.0070.00016.52
7.3.280.0080.00916.47
7.3.270.0110.00617.40
7.3.260.0040.01316.66
7.3.250.0120.01016.45
7.3.240.0070.01016.45
7.3.230.0110.01016.47
7.3.210.0090.01316.58
7.3.200.0140.00316.75
7.3.190.0100.00616.53
7.3.180.0130.00316.35
7.3.170.0120.00616.48
7.3.160.0120.00316.54
7.3.130.0090.00914.99
7.3.120.0110.00715.08
7.3.110.0160.00014.83
7.3.100.0070.00715.11
7.3.90.0060.00914.79
7.3.80.0080.00815.09
7.3.70.0030.01114.95
7.3.60.0040.01114.89
7.3.50.0060.00314.99
7.3.40.0030.00915.00
7.3.30.0030.01014.81
7.3.20.0030.00616.76
7.3.10.0100.00316.90
7.3.00.0040.01116.54
7.2.330.0090.00916.88
7.2.320.0120.00616.84
7.2.310.0030.01316.89
7.2.300.0100.01316.51
7.2.290.0030.02016.84
7.2.260.0030.01215.13
7.2.250.0000.01915.05
7.2.240.0130.00315.05
7.2.230.0030.01215.07
7.2.220.0040.01114.85
7.2.210.0030.01115.00
7.2.200.0040.01115.07
7.2.190.0080.00414.92
7.2.180.0030.00914.85
7.2.170.0000.01415.12
7.2.160.0030.00915.20
7.2.150.0030.00816.82
7.2.140.0090.00316.76
7.2.130.0070.00716.99
7.2.120.0040.01116.99
7.2.110.0120.00616.98
7.2.100.0140.00716.88
7.2.90.0100.00316.86
7.2.80.0030.01017.06
7.2.70.0100.00716.97
7.2.60.0160.00616.85
7.2.50.0070.00716.95
7.2.40.0000.01216.94
7.2.30.0070.00317.05
7.2.20.0000.01316.80
7.2.10.0090.00916.80
7.2.00.0080.00817.05
7.1.330.0070.00715.97
7.1.320.0030.00715.99
7.1.310.0060.00615.80
7.1.300.0030.00715.55
7.1.290.0080.00415.71
7.1.280.0090.00315.77
7.1.270.0030.01215.96
7.1.260.0080.00415.46
7.1.250.0070.00715.70
7.1.240.0090.00315.86
7.1.230.0100.00615.80
7.1.220.0070.01315.89
7.1.210.0030.00915.87
7.1.200.0030.01215.72
7.1.190.0070.00315.95
7.1.180.0110.00416.03
7.1.170.0070.00315.69
7.1.160.0030.00915.85
7.1.150.0080.00615.88
7.1.140.0030.01015.89
7.1.130.0040.01115.93
7.1.120.0060.00615.82
7.1.110.0070.00715.87
7.1.100.0110.00415.96
7.1.90.0090.00615.83
7.1.80.0060.00915.75
7.1.70.0060.00516.57
7.1.60.0080.00917.66
7.1.50.0050.01216.51
7.1.40.0140.00015.80
7.1.30.0100.00315.55
7.1.20.0070.00415.52
7.1.10.0130.00315.55
7.1.00.0040.04019.05
7.0.330.0000.00815.39
7.0.320.0080.00515.50
7.0.310.0170.00015.42
7.0.300.0030.00915.45
7.0.290.0030.01015.61
7.0.280.0030.01215.54
7.0.270.0060.00615.64
7.0.260.0040.00715.47
7.0.250.0030.00615.59
7.0.240.0050.00515.60
7.0.230.0060.00615.55
7.0.220.0060.00315.62
7.0.210.0110.00315.51
7.0.200.0140.00815.11
7.0.190.0030.00615.33
7.0.180.0080.00015.32
7.0.170.0040.00715.21
7.0.160.0000.01415.33
7.0.150.0040.01115.48
7.0.140.0060.00615.39
7.0.130.0030.01015.45
7.0.120.0030.00715.54
7.0.110.0070.00715.52
7.0.100.0080.00815.26
7.0.90.0030.01015.36
7.0.80.0070.00715.47
7.0.70.0070.00715.37
7.0.60.0030.02617.68
7.0.50.0070.02816.78
7.0.40.0080.04616.89
7.0.30.0090.04016.86
7.0.20.0200.03916.77
7.0.10.0100.03316.80
7.0.00.0100.04716.88
5.6.400.0030.00714.47
5.6.390.0060.00314.56
5.6.380.0000.01414.53
5.6.370.0070.00714.39
5.6.360.0030.00614.55
5.6.350.0040.01114.51
5.6.340.0030.00814.41
5.6.330.0030.00614.16
5.6.320.0070.00314.40
5.6.310.0040.00713.98
5.6.300.0060.01014.53
5.6.290.0030.01114.21
5.6.280.0050.03317.67
5.6.270.0110.00314.41
5.6.260.0040.01214.44
5.6.250.0040.00414.43
5.6.240.0070.00714.22
5.6.230.0030.00914.30
5.6.220.0060.00614.30
5.6.210.0050.04817.54
5.6.200.0140.04116.22
5.6.190.0030.04817.49
5.6.180.0170.04317.62
5.6.170.0130.02317.46
5.6.160.0080.02317.47
5.6.150.0050.02316.30
5.6.140.0120.02916.43
5.6.130.0070.03716.26
5.6.120.0100.02217.77
5.6.110.0130.04217.55
5.6.100.0100.04017.69
5.6.90.0070.03917.61
5.6.80.0070.04217.31
5.6.70.0030.00914.50
5.6.60.0060.00714.30
5.6.50.0030.01014.67
5.6.40.0070.00714.13
5.6.30.0030.01314.27
5.6.20.0090.00614.52
5.6.10.0070.00714.46
5.6.00.0000.01214.38
5.5.380.0030.00714.18
5.5.370.0040.01114.71
5.5.360.0060.01214.42
5.5.350.0200.04017.24
5.5.340.0070.04416.09
5.5.330.0080.02517.36
5.5.320.0050.04217.30
5.5.310.0130.04317.31
5.5.300.0080.02616.18
5.5.290.0040.04716.21
5.5.280.0080.03217.70
5.5.270.0060.04317.44
5.5.260.0020.04717.56
5.5.250.0060.04517.46
5.5.240.0050.04417.35
5.5.230.0070.00414.23
5.5.220.0000.01014.09
5.5.210.0110.00413.95
5.5.200.0000.01113.80
5.5.190.0060.00914.54
5.5.180.0000.01413.91
5.5.170.0080.00613.80
5.5.160.0090.00614.13
5.5.150.0030.00914.51
5.5.140.0060.00314.15
5.5.130.0030.01014.39
5.5.120.0060.00614.35
5.5.110.0070.00714.39
5.5.100.0100.00714.28
5.5.90.0030.00914.50
5.5.80.0030.00914.08
5.5.70.0110.00014.23
5.5.60.0040.00414.45
5.5.50.0060.00614.25
5.5.40.0070.00314.39
5.5.30.0030.00813.88
5.5.20.0070.00714.15
5.5.10.0030.01014.51
5.5.00.0070.00714.25

preferences:
62.94 ms | 401 KiB | 5 Q