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 = '26CPpe20dELYZeMhpR8wjkw1%2BtGKfw3%2B1wnJejLf7Ds%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; echo "---res: " . $res; # 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=test'); $adHex = strToHex('id=admin'); 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.4.20.0030.00617.70
8.4.10.0030.00619.80
8.3.150.0120.00616.87
8.3.140.0000.00918.87
8.3.130.0060.00318.39
8.3.120.0150.00018.74
8.3.110.0160.00020.94
8.3.100.0080.00024.06
8.3.90.0120.00326.77
8.3.80.0060.00317.97
8.3.70.0100.01018.56
8.3.60.0130.01018.46
8.3.50.0120.00521.97
8.3.40.0120.00318.71
8.3.30.0110.01118.59
8.3.20.0070.00021.64
8.3.10.0040.00421.73
8.3.00.0040.00422.10
8.2.270.0150.00416.44
8.2.260.0120.00616.75
8.2.250.0000.00816.92
8.2.240.0100.00019.01
8.2.230.0030.00622.58
8.2.220.0040.00437.54
8.2.210.0150.00426.77
8.2.200.0000.00918.16
8.2.190.0130.00316.63
8.2.180.0030.01416.50
8.2.170.0120.00322.96
8.2.160.0030.01222.14
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0000.00917.72
8.2.120.0070.00026.35
8.2.110.0060.00321.03
8.2.100.0030.00917.78
8.2.90.0040.00417.63
8.2.80.0080.00018.65
8.2.70.0000.00817.37
8.2.60.0050.00517.93
8.2.50.0030.00618.07
8.2.40.0040.00418.10
8.2.30.0040.00417.97
8.2.20.0040.00418.07
8.2.10.0040.00417.88
8.2.00.0040.00417.50
8.1.310.0060.01015.95
8.1.300.0080.00020.21
8.1.290.0030.00630.84
8.1.280.0170.00325.92
8.1.270.0040.00422.19
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0120.00021.96
8.1.230.0000.01122.82
8.1.220.0080.00017.74
8.1.210.0080.00018.77
8.1.200.0060.00317.10
8.1.190.0060.00317.23
8.1.180.0060.00318.10
8.1.170.0030.00618.58
8.1.160.0000.00818.73
8.1.150.0000.00722.05
8.1.140.0040.00419.43
8.1.130.0050.00318.99
8.1.120.0030.00317.24
8.1.110.0030.00617.32
8.1.100.0040.00417.38
8.1.90.0000.00717.25
8.1.80.0000.00717.40
8.1.70.0040.00417.36
8.1.60.0080.00017.37
8.1.50.0040.00417.33
8.1.40.0040.00417.35
8.1.30.0000.00717.45
8.1.20.0000.00817.46
8.1.10.0080.00017.41
8.1.00.0030.00617.23
8.0.300.0000.00818.77
8.0.290.0030.00616.58
8.0.280.0030.00318.27
8.0.270.0030.00317.04
8.0.260.0000.00617.03
8.0.250.0000.00716.93
8.0.240.0100.00016.88
8.0.230.0040.00416.90
8.0.220.0030.00316.87
8.0.210.0030.00316.85
8.0.200.0030.00316.94
8.0.190.0030.00316.82
8.0.180.0070.00016.75
8.0.170.0070.00016.83
8.0.160.0040.00416.85
8.0.150.0000.00716.80
8.0.140.0030.00316.79
8.0.130.0050.00013.29
8.0.120.0070.00016.87
8.0.110.0040.00416.89
8.0.100.0000.00716.79
8.0.90.0000.00716.92
8.0.80.0070.01016.86
8.0.70.0000.00716.89
8.0.60.0000.00716.75
8.0.50.0000.00816.81
8.0.30.0100.01117.09
8.0.20.0130.00717.40
8.0.10.0030.00516.87
8.0.00.0030.01416.73
7.4.330.0030.00315.55
7.4.320.0040.00416.55
7.4.300.0000.00716.64
7.4.290.0030.00416.55
7.4.280.0000.00816.62
7.4.270.0000.00716.74
7.4.260.0040.00416.60
7.4.250.0000.00716.55
7.4.240.0020.00516.69
7.4.230.0000.00716.53
7.4.220.0060.01316.82
7.4.210.0120.00316.60
7.4.200.0000.00716.48
7.4.160.0070.00916.66
7.4.150.0080.00817.40
7.4.140.0090.00917.86
7.4.130.0080.00916.73
7.4.120.0150.00616.72
7.4.110.0100.01016.82
7.4.100.0090.01116.77
7.4.90.0070.01516.82
7.4.80.0050.01919.39
7.4.70.0130.00316.80
7.4.60.0160.00016.52
7.4.50.0100.00316.64
7.4.40.0070.01016.59
7.4.30.0120.00616.68
7.4.10.0110.00715.24
7.4.00.0100.00715.04
7.3.330.0000.00813.48
7.3.320.0050.00013.41
7.3.310.0070.00016.55
7.3.300.0070.00016.42
7.3.290.0060.01016.47
7.3.280.0090.00816.46
7.3.270.0150.00317.40
7.3.260.0050.01416.70
7.3.250.0110.00716.66
7.3.240.0160.00316.56
7.3.230.0130.00616.71
7.3.210.0060.01516.80
7.3.200.0000.01716.55
7.3.190.0090.00616.60
7.3.180.0000.01616.62
7.3.170.0140.03416.46
7.3.160.0090.00916.45
7.3.130.0110.01114.70
7.3.120.0060.01015.14
7.3.110.0070.01214.95
7.3.100.0010.01314.88
7.3.90.0030.01214.96
7.3.80.0050.00514.69
7.3.70.0090.00314.84
7.3.60.0040.01114.88
7.3.50.0080.00514.81
7.3.40.0040.01215.01
7.3.30.0080.00615.06
7.3.20.0080.00716.79
7.3.10.0050.01216.85
7.3.00.0050.01016.65
7.2.330.0210.00016.67
7.2.320.0120.00616.81
7.2.310.0100.00716.65
7.2.300.0060.01216.92
7.2.290.0060.01716.85
7.2.260.0100.01015.36
7.2.250.0100.00915.21
7.2.240.0080.00915.05
7.2.230.0050.01115.33
7.2.220.0070.00515.09
7.2.210.0110.00315.11
7.2.200.0050.00715.02
7.2.190.0030.01015.24
7.2.180.0070.00715.15
7.2.170.0070.00915.19
7.2.160.0100.00714.96
7.2.150.0170.00017.05
7.2.140.0100.01016.84
7.2.130.0100.00516.93
7.2.120.0030.01116.73
7.2.110.0030.01017.01
7.2.100.0050.01216.83
7.2.90.0030.01317.01
7.2.80.0060.00817.01
7.2.70.0040.00817.02
7.2.60.0020.01517.11
7.2.50.0050.01117.03
7.2.40.0070.00616.87
7.2.30.0050.00917.05
7.2.20.0030.01217.08
7.2.10.0060.00716.99
7.2.00.0020.01316.98
7.1.330.0090.00515.88
7.1.320.0040.01115.79
7.1.310.0020.01215.71
7.1.300.0090.00615.94
7.1.290.0010.01015.82
7.1.280.0060.00915.79
7.1.270.0050.00915.83
7.1.260.0060.00815.89
7.1.250.0080.00515.81
7.1.240.0080.00715.78
7.1.230.0050.01115.85
7.1.220.0080.00715.84
7.1.210.0020.01015.72
7.1.200.0020.01115.85
7.1.190.0020.01015.91
7.1.180.0060.01015.85
7.1.170.0040.00715.84
7.1.160.0030.01115.95
7.1.150.0100.00315.84
7.1.140.0060.00815.93
7.1.130.0060.00715.77
7.1.120.0070.00915.75
7.1.110.0090.00615.71
7.1.100.0040.00915.82
7.1.90.0060.00616.01
7.1.80.0130.00215.95
7.1.70.0050.00816.20
7.1.60.0380.00815.78
7.1.50.0060.00515.75
7.1.40.0090.00315.66
7.1.30.0040.00815.84
7.1.20.0060.01015.85
7.1.10.0040.02718.02
7.1.00.0130.02118.02
7.0.330.0020.01115.52
7.0.320.0090.00315.34
7.0.310.0050.01015.28
7.0.300.0030.00815.42
7.0.290.0050.00615.19
7.0.280.0070.00715.58
7.0.270.0100.00215.40
7.0.260.0020.01215.46
7.0.250.0070.00315.58
7.0.240.0050.00715.57
7.0.230.0050.00915.44
7.0.220.0060.00715.48
7.0.210.0080.00515.54
7.0.200.0040.00716.05
7.0.190.0020.00815.29
7.0.180.0050.01115.64
7.0.170.0080.00715.33
7.0.160.0070.00815.52
7.0.150.0040.02417.66
7.0.140.0090.02217.72
7.0.130.0070.02317.65
7.0.120.0070.02417.73
7.0.110.0100.02117.67
7.0.100.0050.02517.65
7.0.90.0020.03217.72
7.0.80.0080.02617.59
7.0.70.0060.02517.68
7.0.60.0070.02517.58
7.0.50.0060.02617.62
7.0.40.0070.02316.24
7.0.30.0040.02416.24
7.0.20.0050.02616.41
7.0.10.0070.02516.40
7.0.00.0070.02316.31
5.6.400.0060.00814.61
5.6.390.0100.01014.38
5.6.380.0080.00314.39
5.6.370.0070.00714.68
5.6.360.0000.01114.48
5.6.350.0070.00314.40
5.6.340.0060.00914.50
5.6.330.0040.00814.28
5.6.320.0040.00714.51
5.6.310.0000.01214.42
5.6.300.0120.00314.40
5.6.290.0040.01414.50
5.6.280.0070.00714.45
5.6.270.0070.00714.35
5.6.260.0060.01014.39
5.6.250.0060.00914.56
5.6.240.0040.00714.53
5.6.230.0000.01714.47
5.6.220.0060.01014.27
5.6.210.0070.01414.39
5.6.200.0030.00914.39
5.6.190.0090.00614.43
5.6.180.0030.01414.51
5.6.170.0000.01414.51
5.6.160.0030.00914.68
5.6.150.0090.00614.43
5.6.140.0040.00714.29
5.6.130.0090.00614.23
5.6.120.0030.01214.30
5.6.110.0100.00314.50
5.6.100.0060.00914.61
5.6.90.0000.01214.46
5.6.80.0040.00814.40
5.6.70.0050.00514.55
5.6.60.0100.00314.34
5.6.50.0090.00314.69
5.6.40.0120.00314.37
5.6.30.0050.00514.29
5.6.20.0040.00414.33
5.6.10.0030.00614.50
5.6.00.0120.00314.50

preferences:
28.52 ms | 403 KiB | 5 Q