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.0040.01116.88
8.3.50.0140.00521.20
8.3.40.0090.00618.92
8.3.30.0150.00018.94
8.3.20.0080.00020.38
8.3.10.0030.00623.61
8.3.00.0000.00823.61
8.2.180.0040.01818.18
8.2.170.0150.00018.99
8.2.160.0070.01322.96
8.2.150.0030.01024.18
8.2.140.0050.00324.66
8.2.130.0040.00419.83
8.2.120.0040.00426.35
8.2.110.0090.00020.34
8.2.100.0040.00817.76
8.2.90.0000.00819.21
8.2.80.0060.00317.97
8.2.70.0060.00317.63
8.2.60.0000.00818.03
8.2.50.0080.00018.07
8.2.40.0050.00320.36
8.2.30.0000.00820.55
8.2.20.0030.00518.00
8.2.10.0040.00418.19
8.2.00.0040.00418.15
8.1.280.0070.01425.92
8.1.270.0080.00022.14
8.1.260.0070.00428.09
8.1.250.0080.00028.09
8.1.240.0030.00723.81
8.1.230.0080.00420.93
8.1.220.0000.00817.79
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0030.00618.59
8.1.160.0040.00420.85
8.1.150.0060.00318.84
8.1.140.0060.00319.62
8.1.130.0000.00717.60
8.1.120.0040.00417.52
8.1.110.0040.00417.54
8.1.100.0000.00817.56
8.1.90.0040.00417.41
8.1.80.0030.00717.45
8.1.70.0000.00717.41
8.1.60.0040.00417.56
8.1.50.0040.00417.45
8.1.40.0000.00817.55
8.1.30.0060.00317.62
8.1.20.0000.00817.55
8.1.10.0050.00317.48
8.1.00.0040.00417.55
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0040.00418.41
8.0.270.0000.00717.34
8.0.260.0070.00017.27
8.0.250.0000.00717.10
8.0.240.0000.00716.98
8.0.230.0000.00717.09
8.0.220.0030.00317.04
8.0.210.0000.00716.99
8.0.200.0000.00616.92
8.0.190.0000.00817.05
8.0.180.0050.00216.86
8.0.170.0060.00316.92
8.0.160.0000.00716.87
8.0.150.0080.00016.91
8.0.140.0000.00717.00
8.0.130.0000.00613.42
8.0.120.0030.00517.08
8.0.110.0000.00816.89
8.0.100.0040.00417.05
8.0.90.0040.00417.07
8.0.80.0110.00417.07
8.0.70.0000.00816.86
8.0.60.0000.00817.02
8.0.50.0040.00416.87
8.0.30.0120.00617.14
8.0.20.0110.01217.42
8.0.10.0040.00417.00
8.0.00.0130.00717.03
7.4.330.0000.00516.66
7.4.320.0060.00016.46
7.4.300.0030.00316.55
7.4.290.0030.00316.53
7.4.280.0050.00516.48
7.4.270.0040.00416.50
7.4.260.0040.00416.53
7.4.250.0000.00716.66
7.4.240.0050.00316.60
7.4.230.0000.00716.45
7.4.220.0130.00716.58
7.4.210.0050.01016.56
7.4.200.0070.00016.32
7.4.160.0030.01216.45
7.4.150.0160.00317.40
7.4.140.0090.01517.86
7.4.130.0090.00916.61
7.4.120.0090.00816.52
7.4.110.0060.01216.66
7.4.100.0160.00316.54
7.4.90.0130.00716.81
7.4.80.0140.00519.39
7.4.70.0180.00016.75
7.4.60.0030.01516.57
7.4.50.0060.00916.28
7.4.40.0140.00316.65
7.4.30.0100.00716.67
7.4.00.0100.00714.85
7.3.330.0050.00013.33
7.3.320.0000.00513.43
7.3.310.0050.00316.36
7.3.300.0000.00816.32
7.3.290.0030.00316.32
7.3.280.0100.00516.40
7.3.270.0100.00717.40
7.3.260.0070.01116.47
7.3.250.0100.00916.46
7.3.240.0110.00616.47
7.3.230.0120.00616.43
7.3.210.0140.00316.56
7.3.200.0070.01119.39
7.3.190.0070.01016.47
7.3.180.0100.00716.44
7.3.170.0060.00916.60
7.3.160.0130.01316.44
7.3.10.0260.00016.50
7.3.00.0080.01416.46
7.2.330.0110.00716.61
7.2.320.0130.00716.71
7.2.310.0130.00316.84
7.2.300.0080.01216.46
7.2.290.0120.00616.79
7.2.130.0080.00816.39
7.2.120.0190.00216.72
7.2.110.0070.00916.57
7.2.100.0030.01016.43
7.2.90.0000.01516.68
7.2.80.0110.00416.76
7.2.70.0100.00316.55
7.2.60.0060.01016.75
7.2.50.0080.00416.71
7.2.40.0090.00616.77
7.2.30.0050.00716.48
7.2.20.0130.00316.66
7.2.10.0030.00816.75
7.2.00.0070.00518.24
7.1.250.0240.00315.31
7.1.200.0070.00015.79
7.1.100.0040.00818.14
7.1.70.0060.00317.09
7.1.60.0100.01419.06
7.1.50.0030.01016.98
7.1.00.0030.07722.36
7.0.200.0120.00614.70
7.0.60.0130.07321.57
7.0.50.0130.08018.00
7.0.40.0030.09020.30
7.0.30.0300.04720.32
7.0.20.0370.07320.30
7.0.10.0070.06720.23
7.0.00.0230.07020.10
5.6.280.0070.05720.95
5.6.210.0000.04320.63
5.6.200.0070.07318.30
5.6.190.0130.04720.48
5.6.180.0230.04020.34
5.6.170.0200.06320.52
5.6.160.0130.07720.58
5.6.150.0070.07318.17
5.6.140.0030.04718.20
5.6.130.0070.08018.35
5.6.120.0130.07721.09
5.6.110.0200.07021.04
5.6.100.0130.08021.17
5.6.90.0070.07721.16
5.6.80.0070.03720.49
5.5.350.0030.08020.40
5.5.340.0130.04018.09
5.5.330.0100.07320.46
5.5.320.0500.07020.37
5.5.310.0170.04020.27
5.5.300.0070.08018.08
5.5.290.0070.07317.99
5.5.280.0070.04720.86
5.5.270.0030.09320.73
5.5.260.0030.08320.69
5.5.250.0030.06720.76
5.5.240.0200.07020.42

preferences:
47.44 ms | 401 KiB | 5 Q