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); return $dec; } function Encrypt($ciphertext, $password, $salt) { $key = PBKDF1($password, $salt, 100, 32); $iv = PBKDF1($password, $salt, 100, 16); 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.0100.00716.75
8.3.50.0120.00721.06
8.3.40.0100.01018.84
8.3.30.0040.01118.82
8.3.20.0050.00220.38
8.3.10.0050.00323.56
8.3.00.0030.00523.65
8.2.180.0070.01418.29
8.2.170.0090.00619.07
8.2.160.0110.00422.96
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0030.00619.83
8.2.120.0000.00926.35
8.2.110.0060.00320.85
8.2.100.0090.00317.91
8.2.90.0040.00417.97
8.2.80.0030.00719.89
8.2.70.0080.00017.63
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0000.00822.27
8.2.30.0030.00620.57
8.2.20.0030.00617.72
8.2.10.0060.00318.19
8.2.00.0000.00818.14
8.1.280.0090.01225.92
8.1.270.0110.00322.19
8.1.260.0050.00528.09
8.1.250.0040.00428.09
8.1.240.0060.00322.46
8.1.230.0070.00420.96
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0000.00817.38
8.1.190.0090.00017.48
8.1.180.0040.00418.10
8.1.170.0000.00818.50
8.1.160.0050.00220.80
8.1.150.0040.00418.80
8.1.140.0030.00619.62
8.1.130.0040.00417.61
8.1.120.0030.00517.41
8.1.110.0040.00417.42
8.1.100.0000.00717.54
8.1.90.0000.00717.50
8.1.80.0070.00417.51
8.1.70.0000.00717.38
8.1.60.0050.00317.61
8.1.50.0040.00417.43
8.1.40.0040.00417.59
8.1.30.0030.00517.64
8.1.20.0000.00817.61
8.1.10.0080.00017.57
8.1.00.0000.00817.43
8.0.300.0000.00720.18
8.0.290.0050.00316.75
8.0.280.0000.00718.54
8.0.270.0000.00717.28
8.0.260.0080.00017.32
8.0.250.0000.00717.02
8.0.240.0050.00317.01
8.0.230.0000.00717.05
8.0.220.0000.00717.02
8.0.210.0040.00416.97
8.0.200.0000.00817.11
8.0.190.0050.00317.08
8.0.180.0040.00416.85
8.0.170.0030.00516.99
8.0.160.0040.00417.00
8.0.150.0040.00416.83
8.0.140.0070.00016.92
8.0.130.0060.00013.38
8.0.120.0040.00416.84
8.0.110.0050.00217.00
8.0.100.0040.00417.05
8.0.90.0060.00316.98
8.0.80.0110.00717.04
8.0.70.0070.00016.88
8.0.60.0000.00717.11
8.0.50.0000.00816.94
8.0.30.0090.00617.20
8.0.20.0120.00817.40
8.0.10.0040.00417.10
8.0.00.0080.01016.91
7.4.330.0050.00016.75
7.4.320.0040.00416.45
7.4.300.0000.00616.55
7.4.290.0070.00016.50
7.4.280.0100.00016.44
7.4.270.0000.00716.65
7.4.260.0030.00616.63
7.4.250.0040.00416.50
7.4.240.0070.00016.57
7.4.230.0030.00316.40
7.4.220.0090.01416.57
7.4.210.0060.01016.61
7.4.200.0000.00816.66
7.4.160.0110.00716.50
7.4.150.0160.00317.40
7.4.140.0090.01317.86
7.4.130.0120.00716.59
7.4.120.0100.01116.64
7.4.110.0100.00716.77
7.4.100.0070.01016.61
7.4.90.0060.01216.36
7.4.80.0120.00619.39
7.4.70.0060.01116.61
7.4.60.0070.01016.78
7.4.50.0070.01016.42
7.4.40.0030.01316.61
7.4.30.0140.00716.63
7.4.00.0030.01415.19
7.3.330.0030.00313.38
7.3.320.0030.00313.27
7.3.310.0000.00816.49
7.3.300.0070.00016.32
7.3.290.0040.01116.36
7.3.280.0070.01016.43
7.3.270.0080.01017.40
7.3.260.0100.00716.72
7.3.250.0110.00916.54
7.3.240.0110.00916.47
7.3.230.0100.00716.63
7.3.210.0110.01116.48
7.3.200.0140.00716.54
7.3.190.0140.00916.50
7.3.180.0100.01016.59
7.3.170.0080.01516.42
7.3.160.0110.00716.67
7.2.330.0000.01816.58
7.2.320.0060.01216.79
7.2.310.0180.00016.88
7.2.300.0120.01216.60
7.2.290.0030.01716.48
7.2.110.0170.00716.45
7.2.60.0080.00616.84
7.2.00.0030.01219.41
7.1.200.0060.00615.84
7.1.100.0060.00618.04
7.1.70.0040.01117.37
7.1.60.0100.01419.06
7.1.50.0060.00917.05
7.1.00.0000.08022.35
7.0.200.0130.00614.83
7.0.60.0100.07721.76
7.0.50.0100.04318.00
7.0.40.0130.07320.05
7.0.30.0200.04720.13
7.0.20.0330.06020.21
7.0.10.0070.08720.10
7.0.00.0100.08020.12
5.6.280.0000.06721.15
5.6.210.0070.08720.79
5.6.200.0170.07018.20
5.6.190.0030.09020.58
5.6.180.0270.04320.48
5.6.170.0330.05720.40
5.6.160.0100.03720.54
5.6.150.0100.06718.16
5.6.140.0070.07718.20
5.6.130.0130.07718.16
5.6.120.0100.08321.08
5.6.110.0100.08721.17
5.6.100.0070.07021.17
5.6.90.0070.08021.14
5.6.80.0100.08020.44
5.5.350.0030.07020.46
5.5.340.0070.08018.11
5.5.330.0070.08020.59
5.5.320.0700.05720.31
5.5.310.0270.04320.31
5.5.300.0070.08018.07
5.5.290.0030.08318.02
5.5.280.0030.04021.04
5.5.270.0070.05320.85
5.5.260.0070.07020.96
5.5.250.0070.08720.51
5.5.240.0170.08020.34

preferences:
51.85 ms | 401 KiB | 5 Q