3v4l.org

run code in 300+ PHP versions simultaneously
<?php function strToHex($string){ $hex = ''; for ($i=0; $i<strlen($string); $i++){ $ord = ord($string[$i]); $hexCode = dechex($ord); $hex .= substr('0'.$hexCode, -2); } return strToUpper($hex); } function hexToStr($hex){ $string=''; for ($i=0; $i < strlen($hex)-1; $i+=2){ $string .= chr(hexdec($hex[$i].$hex[$i+1])); } return $string; } function fxor($key, $text){ // Our output text $outText = ''; // Iterate through each character for($i=0;$i<strlen($text);) // Dont need to increment here { for($j=0;$j<strlen($key);$j++,$i++) { $outText .= $text{$i} ^ $key{$j}; } } return $outText; } $ciphertext_base64 = 'sf7PwIfhqofFlKAIgYMKEbExOoVzSj9A0KDwKMJY62k%3D'; $ciphertextHex = strToHex($ciphertext_base64); echo "ciipher hex: " . $ciphertextHex . "\n"; $hexToBase = hexToStr($ciphertextHex); echo "hexToBase: " . $hexToBase . "\n"; echo "ciher base: " . $ciphertext_base64 . "\n"; $ciphertext_dec = base64_decode($ciphertext_base64); # --- DECRYPTION --- echo "cipher text dec: " . $ciphertext_dec . "\n"; echo "ciher dec in hex" . strToHex($ciphertext_dec) . "\n"; $iv = substr($ciphertext_dec,0, 16); $res = substr($ciphertext_dec, 16, strlen($ciphertext_dec)-16); echo "---iv: " . $iv . "\n"; echo "---res: " . $res . "\n"; # retrieves the IV, iv_size should be created using mcrypt_get_iv_size() $iv_dec = substr($ciphertext_dec, 0, 16); echo "iv dec: " . $iv_dec . "\n"; # retrieves the cipher text (everything except the $iv_size in the front) $ciphertext_dec = substr($ciphertext_dec, 16); echo "on the right: " . $ciphertext_dec . "\n"; $ivHex = strToHex($iv_dec); echo "change string to hex (iv): " .$ivHex . "\n"; echo "w druga manke: " . hexToStr($ivHex) . "\n"; $onRightHex = strToHex($ciphertext_dec); echo "onRight in hex: " . $onRightHex . "\n"; echo "w druga manke: " . hexToStr( strToHex($ciphertext_dec) ) . "\n"; $testHex = strToHex('id=1'); $adHex = strToHex('id=2'); echo "testHex: " . $testHex . "\n"; echo "adHex: " . $adHex . "\n"; $xta = strToUpper( dechex(hexdec($testHex) ^ hexdec($adHex)) ); # $myXor = fxor($testHex, $adHex ); echo "xta: " . $xta . "\n"; # echo "myXor: " . $myXor . "\n"; $ivHex2 = substr($ivHex, 16, 32); $ivHex1 = substr($ivHex, 0, 16); echo "ivHex2: " . $ivHex2 . "\n"; echo "ivHex1: " . $ivHex1 . "\n"; $xivxta = strToUpper( dechex(hexdec($xta) ^ hexdec($ivHex2)) ); echo "xivxta: " . $xivxta . "\n"; $cmpHex = $ivHex1 . $xivxta . $onRightHex; echo "cmpHex: " . $cmpHex . "\n"; $cmpStr = hexToStr($cmpHex); echo "cmpStr: " . $cmpStr . "\n"; $cmpB = base64_encode($cmpStr); echo "cmpB: " . $cmpB; ?>

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.0150.00316.50
8.3.50.0140.00717.89
8.3.40.0120.00318.89
8.3.30.0030.01018.54
8.3.20.0040.00421.90
8.3.10.0040.00423.60
8.3.00.0080.00022.10
8.2.180.0100.01318.16
8.2.170.0110.00322.96
8.2.160.0000.01422.13
8.2.150.0050.00224.18
8.2.140.0030.00624.66
8.2.130.0030.00526.16
8.2.120.0000.00821.03
8.2.110.0060.00322.20
8.2.100.0110.00017.47
8.2.90.0080.00019.38
8.2.80.0050.00318.61
8.2.70.0100.00616.97
8.2.60.0030.00717.80
8.2.50.0040.00418.07
8.2.40.0030.00617.78
8.2.30.0000.00818.04
8.2.20.0050.00217.84
8.2.10.0000.00917.87
8.2.00.0050.00317.48
8.1.280.0150.00025.92
8.1.270.0050.00323.91
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00323.84
8.1.230.0040.00719.13
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0000.01017.23
8.1.190.0040.00417.10
8.1.180.0000.00818.10
8.1.170.0040.00418.54
8.1.160.0000.00718.66
8.1.150.0070.00018.54
8.1.140.0000.00719.52
8.1.130.0040.00418.86
8.1.120.0030.00617.36
8.1.110.0030.00617.38
8.1.100.0040.00417.23
8.1.90.0060.00317.25
8.1.80.0040.00417.32
8.1.70.0030.00317.34
8.1.60.0050.00317.47
8.1.50.0040.00417.32
8.1.40.0040.00417.27
8.1.30.0030.00517.52
8.1.20.0000.00817.46
8.1.10.0050.00317.39
8.1.00.0030.00517.25
8.0.300.0070.00018.77
8.0.290.0040.00416.63
8.0.280.0000.00718.25
8.0.270.0070.00016.79
8.0.260.0000.00717.16
8.0.250.0030.00516.93
8.0.240.0000.00716.97
8.0.230.0030.00516.87
8.0.220.0030.00316.82
8.0.210.0030.00316.75
8.0.200.0000.01016.89
8.0.190.0040.00416.93
8.0.180.0000.00816.77
8.0.170.0040.00416.89
8.0.160.0030.00516.90
8.0.150.0030.00716.80
8.0.140.0000.00716.86
8.0.130.0060.00013.32
8.0.120.0050.00216.73
8.0.110.0000.00816.90
8.0.100.0000.00716.81
8.0.90.0040.00416.90
8.0.80.0100.01016.92
8.0.70.0040.00416.92
8.0.60.0000.00716.95
8.0.50.0020.00516.97
8.0.30.0080.00917.00
8.0.20.0090.01217.40
8.0.10.0040.00416.94
8.0.00.0060.01016.75
7.4.330.0000.00515.55
7.4.320.0040.00416.76
7.4.300.0000.00616.66
7.4.290.0030.00316.70
7.4.280.0070.00016.63
7.4.270.0030.00316.78
7.4.260.0050.00216.64
7.4.250.0070.00016.59
7.4.240.0030.00316.50
7.4.230.0070.00016.83
7.4.220.0100.01016.64
7.4.210.0050.00916.67
7.4.200.0030.00316.72
7.4.160.0060.00916.68
7.4.150.0110.00717.40
7.4.140.0090.01517.86
7.4.130.0070.01116.75
7.4.120.0080.01216.71
7.4.110.0040.01416.66
7.4.100.0160.00316.56
7.4.90.0120.00616.75
7.4.80.0090.00919.39
7.4.70.0110.00716.57
7.4.60.0080.00816.59
7.4.50.0000.01516.71
7.4.40.0090.00916.58
7.4.30.0060.01216.72
7.4.10.0070.01416.46
7.4.00.0020.01515.76
7.3.330.0060.00313.56
7.3.320.0000.00613.36
7.3.310.0000.00916.53
7.3.300.0030.00316.49
7.3.290.0000.00716.34
7.3.280.0080.01116.49
7.3.270.0120.00617.40
7.3.260.0080.01316.61
7.3.250.0120.00816.55
7.3.240.0140.00916.61
7.3.230.0050.01316.46
7.3.210.0070.01016.53
7.3.200.0140.00316.39
7.3.190.0110.00516.50
7.3.180.0030.01416.57
7.3.170.0030.01916.71
7.3.160.0090.00916.34
7.3.130.0060.01516.68
7.3.120.0090.00915.81
7.3.110.0080.00915.75
7.3.100.0090.00415.79
7.3.90.0120.00715.74
7.3.80.0040.00715.52
7.3.70.0030.00815.65
7.3.60.0080.00915.70
7.3.50.0070.00715.77
7.3.40.0050.00715.71
7.3.30.0040.00715.66
7.3.20.0100.00517.64
7.3.10.0050.00917.52
7.3.00.0050.00817.51
7.2.330.0110.00816.84
7.2.320.0150.00916.76
7.2.310.0110.00516.90
7.2.300.0060.01216.62
7.2.290.0030.01716.65
7.2.260.0090.01216.65
7.2.250.0050.01416.03
7.2.240.0110.00916.10
7.2.230.0050.01215.91
7.2.220.0100.00516.11
7.2.210.0090.00715.89
7.2.200.0050.01115.93
7.2.190.0060.01015.94
7.2.180.0080.00715.81
7.2.170.0050.01215.84
7.2.160.0030.01016.59
7.2.150.0000.01618.46
7.2.140.0070.01118.50
7.2.130.0070.00718.37
7.2.120.0000.01618.27
7.2.110.0080.00318.30
7.2.100.0040.00818.52
7.2.90.0030.00718.52
7.2.80.0070.00718.70
7.2.70.0090.00318.66
7.2.60.0030.01418.72
7.2.50.0030.00618.43
7.2.40.0110.00418.70
7.2.30.0070.00718.50
7.2.20.0070.01018.39
7.2.10.0000.01718.59
7.2.00.0060.00618.43
7.1.330.0050.01016.76
7.1.320.0050.01016.72
7.1.310.0040.01116.69
7.1.300.0070.01016.72
7.1.290.0090.00516.80
7.1.280.0090.00516.65
7.1.270.0070.00816.59
7.1.260.0070.00716.65
7.1.250.0030.01017.51
7.1.240.0030.01217.26
7.1.230.0040.00817.51
7.1.220.0080.00417.50
7.1.210.0150.00017.50
7.1.200.0100.00317.53
7.1.190.0040.00817.32
7.1.180.0080.00817.42
7.1.170.0070.00717.44
7.1.160.0040.00817.30
7.1.150.0060.00617.27
7.1.140.0120.00417.38
7.1.130.0030.01417.24
7.1.120.0030.00917.37
7.1.110.0000.01217.50
7.1.100.0060.00617.39
7.1.90.0060.00617.57
7.1.80.0030.00917.39
7.1.70.0080.00817.32
7.1.60.0170.01116.11
7.1.50.0030.00917.33
7.1.40.0000.00917.49
7.1.30.0030.01017.45
7.1.20.0070.00317.51
7.1.10.0040.05319.80
7.1.00.0020.04719.90
7.0.330.0090.00616.94
7.0.320.0040.01117.16
7.0.310.0080.00317.17
7.0.300.0070.00317.13
7.0.290.0120.00317.16
7.0.280.0070.00317.00
7.0.270.0000.01017.16
7.0.260.0070.00717.18
7.0.250.0040.00417.03
7.0.240.0070.00717.11
7.0.230.0060.00617.07
7.0.220.0070.00717.08
7.0.210.0030.01217.15
7.0.200.0100.00517.06
7.0.190.0080.00817.16
7.0.180.0080.00817.06
7.0.170.0070.00717.08
7.0.160.0080.00816.96
7.0.150.0050.05419.36
7.0.140.0060.04819.56
7.0.130.0070.03319.65
7.0.120.0130.02619.61
7.0.110.0090.03319.55
7.0.100.0140.03019.51
7.0.90.0100.03319.46
7.0.80.0070.03819.56
7.0.70.0070.04119.44
7.0.60.0090.03919.59
7.0.50.0050.03819.66
7.0.40.0070.03318.44
7.0.30.0130.03518.45
7.0.20.0120.02718.47
7.0.10.0110.03018.51
7.0.00.0100.04418.44
5.6.400.0070.00716.24
5.6.390.0070.01015.82
5.6.380.0120.00016.43
5.6.370.0030.00716.33
5.6.360.0040.00816.12
5.6.350.0070.01016.14
5.6.340.0150.00016.20
5.6.330.0030.01016.15
5.6.320.0040.01115.75
5.6.310.0120.00316.49
5.6.300.0040.01515.84
5.6.290.0060.00615.89
5.6.280.0040.01215.95
5.6.270.0060.01016.09
5.6.260.0040.00716.06
5.6.250.0060.00916.09
5.6.240.0070.00316.03
5.6.230.0000.01215.95
5.6.220.0090.00616.25
5.6.210.0030.00716.11
5.6.200.0070.00716.00
5.6.190.0040.00816.00
5.6.180.0060.00816.02
5.6.170.0070.01016.20
5.6.160.0170.00016.11
5.6.150.0040.01116.05
5.6.140.0060.00916.04
5.6.130.0000.01416.02
5.6.120.0030.00716.13
5.6.110.0040.01216.04
5.6.100.0090.00615.89
5.6.90.0060.01015.84
5.6.80.0000.01115.66
5.6.70.0030.01115.99
5.6.60.0070.00715.72
5.6.50.0040.01115.81
5.6.40.0030.01015.95
5.6.30.0000.01615.75
5.6.20.0070.00715.72
5.6.10.0000.01715.83
5.6.00.0060.00915.92

preferences:
59.57 ms | 400 KiB | 5 Q