3v4l.org

run code in 300+ PHP versions simultaneously
<?php #$dec = Decrypt("/TXRfo3Pfg8W47sFKRQYsO5ya6b4fAv9ef3Tt2JCro8=", "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); // 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) { $ciphertext = mb_convert_encoding($ciphertext,'UTF-16LE'); $key = PBKDF1($password, $salt, 100, 32); $iv = PBKDF1($password, $salt, 100, 16); $block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $len = strlen($ciphertext); $padding = $block - ($len % $block); $ciphertext .= str_repeat(chr($padding),$padding); 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.00816.75
8.3.50.0140.00821.28
8.3.40.0090.00918.87
8.3.30.0040.01118.82
8.3.20.0110.00420.39
8.3.10.0040.01123.53
8.3.00.0040.00423.68
8.2.180.0070.01118.66
8.2.170.0150.00719.04
8.2.160.0120.00922.96
8.2.150.0000.00824.18
8.2.140.0110.00824.66
8.2.130.0040.00419.82
8.2.120.0080.00026.35
8.2.110.0040.00422.25
8.2.100.0110.00018.16
8.2.90.0080.00019.30
8.2.80.0050.00317.97
8.2.70.0030.00617.88
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0030.00622.23
8.2.30.0000.00820.64
8.2.20.0050.00217.78
8.2.10.0040.00418.36
8.2.00.0030.00518.20
8.1.280.0180.00025.92
8.1.270.0090.00022.20
8.1.260.0000.00828.09
8.1.250.0040.00428.09
8.1.240.0000.01124.00
8.1.230.0000.01219.10
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0030.00617.47
8.1.190.0050.00317.36
8.1.180.0060.00318.10
8.1.170.0060.00318.62
8.1.160.0000.00720.85
8.1.150.0000.00719.05
8.1.140.0040.00419.67
8.1.130.0040.00417.84
8.1.120.0040.00417.47
8.1.110.0000.00817.46
8.1.100.0000.00717.60
8.1.90.0040.00417.45
8.1.80.0000.00717.55
8.1.70.0070.00017.59
8.1.60.0080.00017.69
8.1.50.0000.00817.52
8.1.40.0040.00417.51
8.1.30.0050.00317.69
8.1.20.0040.00417.58
8.1.10.0040.00417.59
8.1.00.0040.00417.58
8.0.300.0030.00618.77
8.0.290.0000.00816.88
8.0.280.0030.00318.53
8.0.270.0050.00217.36
8.0.260.0070.00017.35
8.0.250.0030.00317.00
8.0.240.0090.00017.07
8.0.230.0000.00717.10
8.0.220.0000.00817.02
8.0.210.0070.00017.00
8.0.200.0030.00317.09
8.0.190.0000.00816.95
8.0.180.0090.00017.06
8.0.170.0040.00417.10
8.0.160.0000.00717.13
8.0.150.0000.00717.02
8.0.140.0070.00016.90
8.0.130.0030.00313.52
8.0.120.0030.00516.93
8.0.110.0040.00416.99
8.0.100.0070.00017.01
8.0.90.0000.00716.86
8.0.80.0060.00917.08
8.0.70.0040.00417.18
8.0.60.0030.00617.12
8.0.50.0030.00616.97
8.0.30.0100.00917.37
8.0.20.0090.00917.40
8.0.10.0040.00416.93
8.0.00.0070.01116.95
7.4.330.0000.00516.70
7.4.320.0030.00316.59
7.4.300.0000.00916.72
7.4.290.0000.00716.68
7.4.280.0050.00516.61
7.4.270.0040.00416.56
7.4.260.0070.00016.46
7.4.250.0000.00816.54
7.4.240.0040.00316.60
7.4.230.0050.00216.73
7.4.220.0130.01316.63
7.4.210.0110.00616.63
7.4.200.0030.00316.51
7.4.160.0130.00316.76
7.4.150.0100.01017.40
7.4.140.0120.01017.86
7.4.130.0110.01316.59
7.4.120.0070.01016.60
7.4.110.0090.00916.66
7.4.100.0130.00616.60
7.4.90.0140.00416.59
7.4.80.0180.00019.39
7.4.70.0200.00016.79
7.4.60.0100.00716.41
7.4.50.0080.00616.61
7.4.40.0210.00016.57
7.4.30.0080.01016.52
7.4.00.0070.01115.11
7.3.330.0050.00013.37
7.3.320.0030.00313.58
7.3.310.0080.00016.54
7.3.300.0030.00316.43
7.3.290.0000.00716.48
7.3.280.0080.01016.52
7.3.270.0130.01017.40
7.3.260.0070.01016.37
7.3.250.0130.00616.63
7.3.240.0100.01016.53
7.3.230.0130.00316.48
7.3.210.0140.00316.66
7.3.200.0180.00316.72
7.3.190.0090.01216.59
7.3.180.0060.01016.59
7.3.170.0150.01016.53
7.3.160.0060.00916.52
7.2.330.0140.01116.65
7.2.320.0170.00716.70
7.2.310.0120.00416.86
7.2.300.0070.01016.78
7.2.290.0070.01016.82
7.2.110.0240.00716.75
7.2.80.0130.00516.73
7.2.60.0070.00716.92
7.1.200.0030.00915.91
7.1.70.0080.00017.23
7.1.60.0150.00919.20
7.1.50.0070.01317.04
7.1.00.0100.06722.36
7.0.200.0220.00414.84
7.0.60.0070.07321.54
7.0.50.0130.07318.00
7.0.40.0030.07020.15
7.0.30.0330.07320.24
7.0.20.0130.05020.38
7.0.10.0070.04020.25
7.0.00.0070.04020.27
5.6.280.0000.03721.02
5.6.210.0070.08720.48
5.6.200.0100.08018.15
5.6.190.0170.07720.44
5.6.180.0370.07320.58
5.6.170.0330.07720.71
5.6.160.0100.08320.48
5.6.150.0030.05018.24
5.6.140.0100.06018.15
5.6.130.0130.04718.18
5.6.120.0030.04721.10
5.6.110.0100.03721.07
5.6.100.0030.04321.05
5.6.90.0130.08721.05
5.6.80.0100.08020.64
5.5.350.0230.06720.46
5.5.340.0100.07318.09
5.5.330.0070.04320.37
5.5.320.0570.05720.42
5.5.310.0200.08720.42
5.5.300.0030.06017.95
5.5.290.0030.06318.05
5.5.280.0170.06320.90
5.5.270.0130.06720.89
5.5.260.0030.04020.95
5.5.250.0070.06020.61
5.5.240.0200.07320.22

preferences:
50.9 ms | 401 KiB | 5 Q