3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = "wpdPVWejqNRYqDTeUJ2Iw06/rnfHAoy5jtgTojiilD0="; $pwd = "ICS2015"; $salt = "7"; $dec = Decrypt($data, $pwd, $salt); echo "Dec: " . $dec . "\r\n"; $enc = Encrypt("boy10@naver.com", $pwd, $salt); echo "Enc: " . $enc . "\r\n"; function Decrypt($ciphertext, $password, $salt) { $ciphertext = base64_decode($ciphertext); $key = PBKDF1($password, $salt, 100, 32); $iv = PBKDF1($password, $salt, 100, 16); // NB: Need 128 not 256 and CBC mode to be compatible $decpad = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext, MCRYPT_MODE_CBC, $iv); $pad = ord($decpad[($len = strlen($decpad)) - 1]); $dec = substr($decpad, 0, strlen($decpad) - $pad); echo $key; echo $iv; return $dec; } function Encrypt($ciphertext, $password, $salt) { $key = PBKDF1($password, $salt, 100, 32); $iv = PBKDF1($password, $salt, 100, 16); echo $key; echo $iv; return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext, MCRYPT_MODE_CBC, $iv)); } function PBKDF1($pass, $salt, $count, $cb) { static $base; static $extra; static $extracount= 0; static $hashno; static $state = 0; if ($state == 0) { $hashno = 0; $state = 1; $key = $pass . $salt; $base = sha1($key, true); for($i = 2; $i < $count; $i++) { $base = sha1($base, true); } } $result = ""; if ($extracount > 0) { $rlen = strlen($extra) - $extracount; if ($rlen >= $cb) { $result = substr($extra, $extracount, $cb); if ($rlen > $cb) { $extracount += $cb; } else { $extra = null; $extracount = 0; } return $result; } $result = substr($extra, $rlen, $rlen); } $current = ""; $clen = 0; $remain = $cb - strlen($result); while ($remain > $clen) { if ($hashno == 0) { $current = sha1($base, true); } else if ($hashno < 1000) { $n = sprintf("%d", $hashno); $tmp = $n . $base; $current .= sha1($tmp, true); } $hashno++; $clen = strlen($current); } // $current now holds at least as many bytes as we need $result .= substr($current, 0, $remain); // Save any left over bytes for any future requests if ($clen > $remain) { $extra = $current; $extracount = $remain; } return $result; } ?>

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.70.0070.00717.00
8.3.60.0130.00317.00
8.3.50.0080.01121.21
8.3.40.0040.01118.78
8.3.30.0040.01118.87
8.3.20.0070.00020.35
8.3.10.0050.00323.52
8.3.00.0050.00323.66
8.2.180.0140.00716.50
8.2.170.0160.00319.21
8.2.160.0090.00622.96
8.2.150.0030.00524.18
8.2.140.0090.00024.66
8.2.130.0030.00719.88
8.2.120.0030.00626.35
8.2.110.0030.00622.29
8.2.100.0000.01317.93
8.2.90.0000.00819.35
8.2.80.0040.00417.97
8.2.70.0060.00317.75
8.2.60.0030.00617.93
8.2.50.0030.00618.07
8.2.40.0040.00422.33
8.2.30.0030.00520.68
8.2.20.0050.00317.97
8.2.10.0040.00418.05
8.2.00.0000.00718.04
8.1.280.0060.00925.92
8.1.270.0130.00622.18
8.1.260.0050.00528.09
8.1.250.0050.00328.09
8.1.240.0060.00323.83
8.1.230.0060.00619.01
8.1.220.0030.00617.74
8.1.210.0030.00618.77
8.1.200.0060.00317.34
8.1.190.0050.00317.23
8.1.180.0030.00618.10
8.1.170.0000.00818.64
8.1.160.0000.00720.72
8.1.150.0040.00419.01
8.1.140.0070.00419.56
8.1.130.0050.00317.81
8.1.120.0020.00517.42
8.1.110.0040.00417.50
8.1.100.0030.00617.51
8.1.90.0050.00317.41
8.1.80.0030.00717.43
8.1.70.0000.00717.39
8.1.60.0000.00817.63
8.1.50.0050.00317.54
8.1.40.0040.00417.64
8.1.30.0000.00817.77
8.1.20.0040.00417.66
8.1.10.0040.00417.63
8.1.00.0000.00817.64
8.0.300.0040.00418.77
8.0.290.0040.00416.86
8.0.280.0070.00018.44
8.0.270.0030.00317.27
8.0.260.0070.00017.20
8.0.250.0000.00717.08
8.0.240.0000.00717.05
8.0.230.0030.00316.93
8.0.220.0040.00416.87
8.0.210.0000.00716.99
8.0.200.0080.00017.02
8.0.190.0080.00017.09
8.0.180.0000.00817.04
8.0.170.0000.00817.09
8.0.160.0030.00517.03
8.0.150.0000.00716.84
8.0.140.0040.00417.02
8.0.130.0060.00013.36
8.0.120.0040.00416.96
8.0.110.0040.00417.02
8.0.100.0040.00416.95
8.0.90.0070.00016.98
8.0.80.0090.00616.94
8.0.70.0000.00817.06
8.0.60.0000.00717.02
8.0.50.0000.00717.05
8.0.30.0110.00417.18
8.0.20.0120.01017.44
8.0.10.0040.00417.02
8.0.00.0060.01316.80
7.4.330.0020.00216.83
7.4.320.0000.00716.61
7.4.300.0090.00016.50
7.4.290.0030.00316.56
7.4.280.0070.00416.56
7.4.270.0000.00816.57
7.4.260.0000.01116.53
7.4.250.0000.00716.59
7.4.240.0000.00916.60
7.4.230.0000.00716.68
7.4.220.0120.00816.58
7.4.210.0090.00716.60
7.4.200.0030.00316.39
7.4.160.0030.01316.60
7.4.150.0060.01217.40
7.4.140.0130.01217.86
7.4.130.0070.01316.64
7.4.120.0080.01016.71
7.4.110.0100.01016.50
7.4.100.0130.01016.65
7.4.90.0080.01016.67
7.4.80.0100.01319.39
7.4.70.0100.00716.65
7.4.60.0090.00916.70
7.4.50.0090.00316.61
7.4.40.0110.00716.73
7.4.30.0140.00416.54
7.4.10.0070.01015.25
7.4.00.0060.00715.06
7.3.330.0000.00513.33
7.3.320.0050.00013.40
7.3.310.0050.00216.45
7.3.300.0000.00716.51
7.3.290.0070.00016.47
7.3.280.0070.01216.46
7.3.270.0110.00617.40
7.3.260.0030.01316.64
7.3.250.0110.01116.51
7.3.240.0120.00516.49
7.3.230.0100.00716.43
7.3.210.0100.00716.55
7.3.200.0100.00916.48
7.3.190.0090.01316.59
7.3.180.0100.00716.72
7.3.170.0100.01016.39
7.3.160.0130.00316.48
7.3.130.0040.01515.01
7.3.120.0070.01015.00
7.3.110.0150.00415.08
7.3.100.0060.00914.85
7.3.90.0090.00614.87
7.3.80.0050.00514.99
7.3.70.0000.01714.84
7.3.60.0030.01214.83
7.3.50.0070.00714.82
7.3.40.0060.00514.64
7.3.30.0060.00914.91
7.3.20.0070.00716.84
7.3.10.0090.00316.57
7.3.00.0120.00316.71
7.2.330.0080.00816.77
7.2.320.0000.01616.56
7.2.310.0100.00816.76
7.2.300.0130.01316.74
7.2.290.0000.01716.89
7.2.260.0060.01215.35
7.2.250.0110.00915.13
7.2.240.0040.00815.15
7.2.230.0060.01015.02
7.2.220.0060.00615.27
7.2.210.0030.00715.11
7.2.200.0090.00615.21
7.2.190.0070.01015.06
7.2.180.0040.00715.24
7.2.170.0100.00314.95
7.2.160.0050.00515.09
7.2.150.0030.00817.01
7.2.140.0100.00316.69
7.2.130.0030.01416.71
7.2.120.0030.01216.70
7.2.110.0090.00616.89
7.2.100.0080.00816.90
7.2.90.0110.00416.91
7.2.80.0000.01417.04
7.2.70.0100.00617.01
7.2.60.0060.00816.87
7.2.50.0110.00616.91
7.2.40.0030.00917.02
7.2.30.0040.00716.78
7.2.20.0040.01216.96
7.2.10.0060.00616.97
7.2.00.0090.00616.66
7.1.330.0040.01115.90
7.1.320.0060.00916.02
7.1.310.0120.00415.94
7.1.300.0060.00315.89
7.1.290.0130.00015.93
7.1.280.0070.00415.89
7.1.270.0130.00015.84
7.1.260.0070.00715.76
7.1.250.0030.01015.63
7.1.240.0100.00015.84
7.1.230.0080.00415.85
7.1.220.0030.01315.82
7.1.210.0070.01015.59
7.1.200.0040.00615.89
7.1.190.0120.00315.64
7.1.180.0070.00715.87
7.1.170.0080.00515.68
7.1.160.0070.00715.86
7.1.150.0030.01015.56
7.1.140.0000.00915.84
7.1.130.0090.00315.71
7.1.120.0040.00815.96
7.1.110.0080.00415.84
7.1.100.0050.00515.84
7.1.90.0030.00915.62
7.1.80.0060.00315.83
7.1.70.0030.00716.57
7.1.60.0100.01117.30
7.1.50.0080.00916.50
7.1.40.0090.00615.98
7.1.30.0050.00515.91
7.1.20.0030.01015.81
7.1.10.0030.01015.81
7.1.00.0070.04118.96
7.0.330.0030.00715.49
7.0.320.0090.00415.48
7.0.310.0060.00615.11
7.0.300.0080.00815.35
7.0.290.0060.00815.25
7.0.280.0120.00015.14
7.0.270.0030.01015.44
7.0.260.0040.01115.29
7.0.250.0040.00715.65
7.0.240.0060.00615.37
7.0.230.0000.01715.36
7.0.220.0030.00915.28
7.0.210.0040.01015.43
7.0.200.0040.01015.13
7.0.190.0110.00415.55
7.0.180.0100.00315.50
7.0.170.0060.00615.39
7.0.160.0000.01515.54
7.0.150.0060.00615.47
7.0.140.0030.01315.54
7.0.130.0040.00815.54
7.0.120.0040.01115.36
7.0.110.0030.00815.40
7.0.100.0030.01015.51
7.0.90.0040.01115.36
7.0.80.0030.00715.53
7.0.70.0100.00715.73
7.0.60.0100.04518.57
7.0.50.0070.02316.83
7.0.40.0060.03016.68
7.0.30.0200.03816.90
7.0.20.0180.04616.90
7.0.10.0080.04316.96
7.0.00.0130.03816.72
5.6.400.0060.00914.16
5.6.390.0000.01614.49
5.6.380.0000.01414.23
5.6.370.0030.01014.16
5.6.360.0070.00714.62
5.6.350.0000.01514.78
5.6.340.0070.00714.68
5.6.330.0030.01014.30
5.6.320.0000.01214.43
5.6.310.0090.00614.55
5.6.300.0070.00414.79
5.6.290.0090.00614.47
5.6.280.0060.01817.53
5.6.270.0090.00614.16
5.6.260.0070.00314.51
5.6.250.0030.01014.39
5.6.240.0080.00314.18
5.6.230.0060.00314.38
5.6.220.0070.01114.20
5.6.210.0100.04017.47
5.6.200.0070.02516.39
5.6.190.0120.04217.63
5.6.180.0230.03317.38
5.6.170.0120.04517.60
5.6.160.0050.02617.52
5.6.150.0120.03816.33
5.6.140.0060.03116.27
5.6.130.0080.02216.41
5.6.120.0030.02717.76
5.6.110.0120.03817.79
5.6.100.0050.05017.75
5.6.90.0110.03517.74
5.6.80.0090.03817.39
5.6.70.0040.00714.33
5.6.60.0060.00314.09
5.6.50.0040.01114.06
5.6.40.0080.00414.00
5.6.30.0030.00914.43
5.6.20.0040.00814.49
5.6.10.0000.01514.38
5.6.00.0090.00614.31
5.5.380.0000.01414.06
5.5.370.0060.00914.31
5.5.360.0030.01314.41
5.5.350.0040.04717.34
5.5.340.0080.03816.23
5.5.330.0080.02317.61
5.5.320.0310.04117.49
5.5.310.0080.04517.27
5.5.300.0110.03316.34
5.5.290.0020.03716.10
5.5.280.0000.02617.67
5.5.270.0050.04417.50
5.5.260.0030.04417.61
5.5.250.0100.04517.40
5.5.240.0150.03217.24
5.5.230.0060.00314.34
5.5.220.0000.01014.47
5.5.210.0060.00614.37
5.5.200.0030.00714.18
5.5.190.0110.00014.41
5.5.180.0060.00614.19
5.5.170.0070.00714.23
5.5.160.0030.01314.37
5.5.150.0060.00314.33
5.5.140.0030.00614.42
5.5.130.0060.00914.22
5.5.120.0040.00814.51
5.5.110.0070.00714.36
5.5.100.0070.00714.17
5.5.90.0090.00014.10
5.5.80.0090.00014.04
5.5.70.0040.00814.29
5.5.60.0030.00914.40
5.5.50.0030.01014.38
5.5.40.0090.00614.05
5.5.30.0000.00914.30
5.5.20.0040.01114.45
5.5.10.0050.00514.55
5.5.00.0040.01114.25

preferences:
38.34 ms | 401 KiB | 5 Q