3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dec = Decrypt("wpdPVWejqNRYqDTeUJ2Iw06/rnfHAoy5jtgTojiilD0=", "ICS2015", "7"); echo "Dec: " . $dec . "\r\n"; $enc = Encrypt("boy10@naver.com", "ICS2015", "7"); 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 base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, "boy10@naver.com", MCRYPT_MODE_CBC, $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); 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.0070.00716.47
8.3.50.0060.00916.59
8.3.40.0040.01118.96
8.3.30.0210.00018.96
8.3.20.0070.00020.38
8.3.10.0040.00423.66
8.3.00.0060.00323.68
8.2.180.0090.01218.29
8.2.170.0040.01122.96
8.2.160.0070.00720.37
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00819.76
8.2.120.0080.00026.35
8.2.110.0090.00022.16
8.2.100.0070.00417.93
8.2.90.0030.00519.21
8.2.80.0040.00418.05
8.2.70.0070.00317.38
8.2.60.0000.00917.90
8.2.50.0080.00018.07
8.2.40.0000.00822.38
8.2.30.0040.00420.66
8.2.20.0000.00717.76
8.2.10.0000.00818.21
8.2.00.0050.00318.16
8.1.280.0100.00725.92
8.1.270.0040.00422.23
8.1.260.0060.00328.09
8.1.250.0050.00328.09
8.1.240.0030.00622.22
8.1.230.0050.00519.15
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0000.01117.35
8.1.190.0000.00817.36
8.1.180.0000.00918.10
8.1.170.0040.00418.52
8.1.160.0000.00720.86
8.1.150.0040.00418.83
8.1.140.0070.00319.65
8.1.130.0030.00317.73
8.1.120.0030.00617.48
8.1.110.0060.00317.49
8.1.100.0000.00717.40
8.1.90.0050.00317.37
8.1.80.0030.00617.54
8.1.70.0000.00717.37
8.1.60.0040.00417.63
8.1.50.0000.00817.34
8.1.40.0040.00417.44
8.1.30.0040.00417.57
8.1.20.0000.00817.73
8.1.10.0030.00617.59
8.1.00.0000.00817.52
8.0.300.0060.00318.77
8.0.290.0040.00417.00
8.0.280.0080.00018.45
8.0.270.0030.00317.22
8.0.260.0030.00318.50
8.0.250.0040.00417.06
8.0.240.0000.00717.03
8.0.230.0040.00417.04
8.0.220.0040.00416.99
8.0.210.0000.00816.89
8.0.200.0030.00316.95
8.0.190.0110.00017.06
8.0.180.0040.00416.91
8.0.170.0000.00817.03
8.0.160.0000.00716.91
8.0.150.0000.00816.92
8.0.140.0070.00016.98
8.0.130.0060.00013.40
8.0.120.0000.00816.94
8.0.110.0000.00716.99
8.0.100.0040.00416.85
8.0.90.0040.00417.02
8.0.80.0060.00916.88
8.0.70.0000.00817.05
8.0.60.0080.00017.03
8.0.50.0050.00316.95
8.0.30.0140.00517.05
8.0.20.0130.00617.42
8.0.10.0070.00017.23
8.0.00.0100.00916.72
7.4.330.0000.00616.79
7.4.320.0040.00416.62
7.4.300.0030.00316.66
7.4.290.0070.00016.66
7.4.280.0070.00316.54
7.4.270.0000.00716.67
7.4.260.0050.00516.53
7.4.250.0070.00016.65
7.4.240.0020.00516.50
7.4.230.0000.00816.54
7.4.220.0040.02216.49
7.4.210.0080.00716.54
7.4.200.0040.00416.52
7.4.160.0130.00316.81
7.4.150.0180.00017.40
7.4.140.0090.01117.86
7.4.130.0130.00416.56
7.4.120.0080.01116.58
7.4.110.0090.00916.60
7.4.100.0090.01416.67
7.4.90.0090.00916.59
7.4.80.0120.00419.39
7.4.70.0100.01316.66
7.4.60.0060.01116.39
7.4.50.0070.00716.34
7.4.40.0060.00916.72
7.4.30.0070.01016.77
7.4.00.0090.00615.21
7.3.330.0000.00613.28
7.3.320.0050.00013.41
7.3.310.0000.00816.44
7.3.300.0000.00716.37
7.3.290.0000.00716.32
7.3.280.0090.01116.46
7.3.270.0080.00917.40
7.3.260.0070.01016.47
7.3.250.0070.00916.42
7.3.240.0100.00816.47
7.3.230.0060.01216.41
7.3.210.0130.00316.50
7.3.200.0060.01016.77
7.3.190.0080.00816.54
7.3.180.0070.01016.39
7.3.170.0030.01316.62
7.3.160.0170.00516.49
7.2.330.0070.01116.98
7.2.320.0110.00616.71
7.2.310.0130.00916.71
7.2.300.0110.01116.79
7.2.290.0100.00716.72
7.2.110.0180.01316.48
7.2.60.0060.00916.84
7.2.00.0030.00919.59
7.1.200.0030.00815.98
7.1.100.0040.00718.11
7.1.70.0070.00717.18
7.1.60.0170.01019.06
7.1.50.0100.00316.69
7.1.00.0000.08022.36
7.0.200.0030.00614.93
7.0.60.0030.09021.78
7.0.50.0100.07317.96
7.0.40.0130.08020.41
7.0.30.0300.07020.14
7.0.20.0270.06020.30
7.0.10.0070.04320.13
7.0.00.0030.04320.23
5.6.280.0070.03021.07
5.6.210.0030.08320.75
5.6.200.0100.04718.25
5.6.190.0070.04020.70
5.6.180.0470.06320.34
5.6.170.0370.07020.45
5.6.160.0070.06320.53
5.6.150.0000.06018.19
5.6.140.0070.05018.16
5.6.130.0200.07318.19
5.6.120.0100.07721.07
5.6.110.0130.07721.09
5.6.100.0030.07320.94
5.6.90.0070.06321.05
5.6.80.0130.07020.60
5.5.350.0030.08720.45
5.5.340.0070.04017.96
5.5.330.0030.08720.27
5.5.320.0470.04720.29
5.5.310.0270.06720.42
5.5.300.0100.03718.15
5.5.290.0000.08318.05
5.5.280.0130.07320.88
5.5.270.0070.08320.89
5.5.260.0130.04720.98
5.5.250.0130.08020.75
5.5.240.0070.04720.26

preferences:
44.5 ms | 400 KiB | 5 Q