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); echo "bb" . base64_encode($iv); // 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); return $dec; } function Encrypt($ciphertext, $password, $salt) { $key = PBKDF1($password, $salt, 100, 32); $iv = PBKDF1($password, $salt, 100, 16); echo "aa" . base64_encode($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.60.0080.00817.13
8.3.50.0110.00416.50
8.3.40.0090.00618.80
8.3.30.0150.00618.67
8.3.20.0000.00820.34
8.3.10.0000.00723.54
8.3.00.0080.00023.56
8.2.180.0160.00318.29
8.2.170.0090.00622.96
8.2.160.0110.00422.24
8.2.150.0040.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00419.70
8.2.120.0000.00826.35
8.2.110.0060.00319.21
8.2.100.0070.00718.03
8.2.90.0080.00017.91
8.2.80.0000.00817.97
8.2.70.0070.00317.75
8.2.60.0040.00418.03
8.2.50.0040.00418.07
8.2.40.0040.00422.38
8.2.30.0030.00520.73
8.2.20.0000.00717.81
8.2.10.0050.00318.07
8.2.00.0040.00418.15
8.1.280.0140.00325.92
8.1.270.0080.00022.13
8.1.260.0040.00428.09
8.1.250.0140.00328.09
8.1.240.0050.00521.96
8.1.230.0060.00620.89
8.1.220.0040.00417.78
8.1.210.0040.00418.90
8.1.200.0060.00317.36
8.1.190.0030.00617.23
8.1.180.0060.00318.10
8.1.170.0080.00018.54
8.1.160.0050.00220.73
8.1.150.0030.00618.85
8.1.140.0030.00719.58
8.1.130.0030.00317.76
8.1.120.0000.00717.43
8.1.110.0000.00817.50
8.1.100.0000.00817.51
8.1.90.0040.00417.41
8.1.80.0000.00817.52
8.1.70.0030.00317.46
8.1.60.0020.00517.59
8.1.50.0000.00817.46
8.1.40.0000.00817.46
8.1.30.0040.00417.68
8.1.20.0030.00517.58
8.1.10.0040.00417.66
8.1.00.0040.00417.57
8.0.300.0050.00320.01
8.0.290.0000.00916.88
8.0.280.0000.00818.49
8.0.270.0030.00317.22
8.0.260.0030.00317.35
8.0.250.0000.00717.09
8.0.240.0030.00517.02
8.0.230.0000.00717.13
8.0.220.0000.00817.02
8.0.210.0070.00016.90
8.0.200.0000.00717.09
8.0.190.0000.00717.02
8.0.180.0030.00517.03
8.0.170.0030.00517.03
8.0.160.0040.00416.92
8.0.150.0040.00416.91
8.0.140.0040.00317.00
8.0.130.0000.00613.45
8.0.120.0040.00416.97
8.0.110.0040.00416.98
8.0.100.0000.00816.95
8.0.90.0040.00417.04
8.0.80.0060.01017.05
8.0.70.0030.00517.07
8.0.60.0050.00317.04
8.0.50.0030.00516.96
8.0.30.0120.00817.26
8.0.20.0060.01317.40
8.0.10.0080.00016.95
8.0.00.0120.00916.76
7.4.330.0020.00216.67
7.4.320.0000.00616.64
7.4.300.0040.00416.54
7.4.290.0000.00716.45
7.4.280.0060.00316.69
7.4.270.0000.00716.57
7.4.260.0000.00716.71
7.4.250.0080.00016.60
7.4.240.0020.00616.63
7.4.230.0000.00716.73
7.4.220.0110.01516.58
7.4.210.0070.00716.56
7.4.200.0040.00416.72
7.4.160.0070.01016.49
7.4.150.0060.01217.40
7.4.140.0120.01217.86
7.4.130.0110.00916.51
7.4.120.0070.01016.69
7.4.110.0120.00616.78
7.4.100.0140.00316.52
7.4.90.0090.00916.59
7.4.80.0050.01319.39
7.4.70.0060.01216.78
7.4.60.0100.01016.68
7.4.50.0030.00716.56
7.4.40.0140.00716.64
7.4.30.0140.00716.48
7.4.10.0080.00415.30
7.4.00.0030.01215.21
7.3.330.0050.00013.43
7.3.320.0030.00313.54
7.3.310.0000.00716.50
7.3.300.0000.00716.54
7.3.290.0070.00016.42
7.3.280.0070.00916.45
7.3.270.0100.00617.40
7.3.260.0060.01216.47
7.3.250.0100.00916.45
7.3.240.0130.00416.69
7.3.230.0030.01716.47
7.3.210.0130.00316.38
7.3.200.0070.01016.52
7.3.190.0060.01016.69
7.3.180.0100.01316.55
7.3.170.0100.00716.60
7.3.160.0130.01016.45
7.3.130.0100.00715.00
7.3.120.0110.00314.84
7.3.110.0060.01214.84
7.3.100.0100.00315.05
7.3.90.0080.01215.14
7.3.80.0060.01215.00
7.3.70.0030.00714.84
7.3.60.0060.00614.63
7.3.50.0070.01114.80
7.3.40.0030.01014.70
7.3.30.0000.01614.98
7.3.20.0000.01516.67
7.3.10.0030.01516.79
7.3.00.0030.00916.51
7.2.330.0070.01116.75
7.2.320.0100.00716.86
7.2.310.0070.01316.79
7.2.300.0130.00616.57
7.2.290.0070.01116.84
7.2.260.0030.01314.74
7.2.250.0090.00915.05
7.2.240.0000.00915.21
7.2.230.0070.00714.80
7.2.220.0060.01314.79
7.2.210.0090.00915.16
7.2.200.0070.00715.03
7.2.190.0030.01415.16
7.2.180.0090.00914.95
7.2.170.0000.01415.21
7.2.160.0120.00415.11
7.2.150.0070.01316.93
7.2.140.0000.01816.95
7.2.130.0070.00716.63
7.2.120.0030.01016.96
7.2.110.0000.01517.02
7.2.100.0120.00317.13
7.2.90.0060.00917.11
7.2.80.0000.01616.78
7.2.70.0000.01716.79
7.2.60.0030.01316.68
7.2.50.0040.01116.86
7.2.40.0030.01216.83
7.2.30.0000.01316.93
7.2.20.0090.00616.91
7.2.10.0000.01216.86
7.2.00.0050.00818.21
7.1.330.0040.01115.76
7.1.320.0110.00715.89
7.1.310.0040.01115.79
7.1.300.0100.01015.76
7.1.290.0090.00915.85
7.1.280.0040.01115.75
7.1.270.0060.00915.87
7.1.260.0140.00315.88
7.1.250.0000.01515.64
7.1.240.0030.01015.84
7.1.230.0070.01015.59
7.1.220.0090.00015.90
7.1.210.0030.00715.96
7.1.200.0070.00315.81
7.1.190.0080.00615.59
7.1.180.0000.01115.64
7.1.170.0000.01415.54
7.1.160.0100.00315.66
7.1.150.0060.00315.82
7.1.140.0090.00615.60
7.1.130.0030.01015.77
7.1.120.0000.01115.68
7.1.110.0040.00815.86
7.1.100.0040.00917.02
7.1.90.0040.00815.75
7.1.80.0060.00915.85
7.1.70.0020.01016.52
7.1.60.0050.00817.42
7.1.50.0050.01216.53
7.1.40.0060.00615.83
7.1.30.0040.00415.53
7.1.20.0070.01015.70
7.1.10.0030.00915.89
7.1.00.0010.04419.20
7.0.330.0040.01115.48
7.0.320.0040.00815.10
7.0.310.0030.00915.53
7.0.300.0030.00714.97
7.0.290.0030.00715.22
7.0.280.0030.00615.37
7.0.270.0050.00515.38
7.0.260.0050.00315.41
7.0.250.0040.01115.51
7.0.240.0110.00615.27
7.0.230.0060.00915.47
7.0.220.0070.00715.60
7.0.210.0040.01115.52
7.0.200.0030.01015.11
7.0.190.0030.00615.34
7.0.180.0030.00915.34
7.0.170.0080.00615.55
7.0.160.0060.00315.41
7.0.150.0090.00015.33
7.0.140.0070.00315.49
7.0.130.0030.01015.43
7.0.120.0040.00415.52
7.0.110.0030.01015.61
7.0.100.0030.01215.63
7.0.90.0070.00715.62
7.0.80.0110.00315.56
7.0.70.0000.01415.29
7.0.60.0020.04718.46
7.0.50.0050.04216.70
7.0.40.0060.04316.98
7.0.30.0180.03516.88
7.0.20.0150.02616.81
7.0.10.0080.03716.68
7.0.00.0150.03216.82
5.6.400.0110.00714.43
5.6.390.0000.01414.36
5.6.380.0070.00714.66
5.6.370.0040.01114.51
5.6.360.0040.01114.51
5.6.350.0040.00714.35
5.6.340.0000.00814.28
5.6.330.0060.00614.68
5.6.320.0000.01514.34
5.6.310.0030.01314.59
5.6.300.0130.00314.77
5.6.290.0060.00914.15
5.6.280.0030.03117.85
5.6.270.0070.00714.38
5.6.260.0100.00314.86
5.6.250.0060.00914.30
5.6.240.0030.01014.10
5.6.230.0000.00914.27
5.6.220.0070.00714.32
5.6.210.0050.02317.51
5.6.200.0100.03216.33
5.6.190.0050.02817.46
5.6.180.0180.02217.50
5.6.170.0150.02017.52
5.6.160.0090.03317.38
5.6.150.0080.03516.45
5.6.140.0030.03416.25
5.6.130.0030.03316.40
5.6.120.0110.02017.78
5.6.110.0070.04117.62
5.6.100.0080.04217.69
5.6.90.0070.04117.77
5.6.80.0080.02317.38
5.6.70.0000.01714.37
5.6.60.0070.00714.38
5.6.50.0120.00314.30
5.6.40.0000.01214.30
5.6.30.0000.01314.05
5.6.20.0070.01014.14
5.6.10.0120.00314.07
5.6.00.0040.01114.42
5.5.380.0050.00514.28
5.5.370.0070.00714.50
5.5.360.0100.00614.52
5.5.350.0080.04417.48
5.5.340.0070.03016.16
5.5.330.0090.02117.57
5.5.320.0270.03817.45
5.5.310.0160.01717.29
5.5.300.0080.03116.24
5.5.290.0100.04216.13
5.5.280.0110.01817.62
5.5.270.0130.03017.51
5.5.260.0070.03317.58
5.5.250.0070.04017.32
5.5.240.0120.03217.11
5.5.230.0030.00814.21
5.5.220.0100.00314.61
5.5.210.0110.00014.42
5.5.200.0070.01014.45
5.5.190.0090.00614.43
5.5.180.0120.00314.13
5.5.170.0000.01714.35
5.5.160.0030.01014.51
5.5.150.0040.01114.21
5.5.140.0030.01014.45
5.5.130.0100.00714.44
5.5.120.0040.01114.45
5.5.110.0060.00914.55
5.5.100.0060.01014.00
5.5.90.0060.00914.16
5.5.80.0070.00714.43
5.5.70.0000.01014.32
5.5.60.0030.01014.42
5.5.50.0040.00714.43
5.5.40.0030.00914.27
5.5.30.0080.00414.55
5.5.20.0040.01214.06
5.5.10.0070.01014.19
5.5.00.0100.00614.12

preferences:
49.69 ms | 404 KiB | 6 Q