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); // 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); return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext, MCRYPT_MODE_CBC, $iv)); } function PBKDF2($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; } 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.70.0080.00818.43
8.3.60.0070.00716.88
8.3.50.0090.01121.09
8.3.40.0110.00718.90
8.3.30.0000.01518.97
8.3.20.0000.00820.34
8.3.10.0040.00423.61
8.3.00.0000.00823.66
8.2.190.0070.00716.58
8.2.180.0160.00616.63
8.2.170.0100.00718.92
8.2.160.0140.00722.96
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0060.00319.65
8.2.120.0070.00026.35
8.2.110.0120.00921.96
8.2.100.0110.00018.04
8.2.90.0050.00319.32
8.2.80.0030.00518.04
8.2.70.0040.00417.75
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0030.00622.28
8.2.30.0000.00720.69
8.2.20.0060.00317.88
8.2.10.0050.00318.14
8.2.00.0000.00818.06
8.1.280.0040.01125.92
8.1.270.0030.00622.17
8.1.260.0080.00028.09
8.1.250.0030.01228.09
8.1.240.0060.00323.83
8.1.230.0120.00018.97
8.1.220.0030.00517.77
8.1.210.0030.00618.77
8.1.200.0060.00317.48
8.1.190.0030.00617.35
8.1.180.0080.00018.10
8.1.170.0030.00518.70
8.1.160.0040.00420.82
8.1.150.0040.00418.87
8.1.140.0040.00619.64
8.1.130.0000.00717.75
8.1.120.0030.00617.39
8.1.110.0000.00717.52
8.1.100.0000.01017.50
8.1.90.0040.00417.50
8.1.80.0070.00317.37
8.1.70.0000.00717.54
8.1.60.0030.00617.64
8.1.50.0000.00817.45
8.1.40.0080.00017.41
8.1.30.0080.00017.69
8.1.20.0000.00817.68
8.1.10.0030.00517.61
8.1.00.0080.00017.58
8.0.300.0070.00018.77
8.0.290.0080.00016.73
8.0.280.0040.00418.50
8.0.270.0040.00417.31
8.0.260.0030.00317.19
8.0.250.0040.00417.09
8.0.240.0000.00716.99
8.0.230.0070.00017.07
8.0.220.0000.00716.95
8.0.210.0000.00816.89
8.0.200.0000.00717.08
8.0.190.0110.00017.07
8.0.180.0040.00417.01
8.0.170.0040.00417.05
8.0.160.0050.00217.11
8.0.150.0050.00217.00
8.0.140.0000.00816.88
8.0.130.0050.00213.43
8.0.120.0030.00516.94
8.0.110.0030.00716.97
8.0.100.0050.00216.96
8.0.90.0050.00216.88
8.0.80.0060.01017.01
8.0.70.0030.00516.89
8.0.60.0000.00716.91
8.0.50.0000.00716.83
8.0.30.0130.00717.28
8.0.20.0120.00817.40
8.0.10.0060.00316.98
8.0.00.0110.00816.86
7.4.330.0000.00516.79
7.4.320.0030.00316.71
7.4.300.0000.00616.49
7.4.290.0030.00316.60
7.4.280.0030.00716.59
7.4.270.0000.00716.62
7.4.260.0000.00716.57
7.4.250.0030.00516.62
7.4.240.0070.00016.66
7.4.230.0030.00316.73
7.4.220.0140.00716.70
7.4.210.0130.00516.64
7.4.200.0070.00016.55
7.4.160.0070.01016.83
7.4.150.0110.00717.40
7.4.140.0100.01117.86
7.4.130.0130.01016.65
7.4.120.0090.01016.66
7.4.110.0150.00316.68
7.4.100.0100.00716.67
7.4.90.0100.01316.57
7.4.80.0140.00319.39
7.4.70.0090.00916.63
7.4.60.0070.01016.59
7.4.50.0060.01016.70
7.4.40.0000.01616.73
7.4.30.0090.00616.57
7.4.00.0000.01415.04
7.3.330.0060.00013.43
7.3.320.0050.00013.41
7.3.310.0080.00016.38
7.3.300.0030.00316.36
7.3.290.0000.00716.44
7.3.280.0100.00916.50
7.3.270.0090.00917.40
7.3.260.0000.01716.56
7.3.250.0070.01016.59
7.3.240.0090.00816.52
7.3.230.0100.01016.48
7.3.210.0070.01016.48
7.3.200.0030.01419.39
7.3.190.0070.01016.72
7.3.180.0060.01016.64
7.3.170.0030.01316.72
7.3.160.0160.00616.54
7.2.330.0070.01116.66
7.2.320.0110.00616.78
7.2.310.0090.00916.77
7.2.300.0140.00516.75
7.2.290.0170.00016.82
7.2.110.0090.00916.45
7.2.60.0070.01016.80
7.2.00.0000.01319.46
7.1.200.0060.00915.80
7.1.100.0040.00717.97
7.1.70.0040.00717.09
7.1.60.0090.01519.06
7.1.50.0030.01017.05
7.1.00.0000.08022.37
7.0.200.0030.01014.88
7.0.60.0030.03721.53
7.0.50.0130.07318.03
7.0.40.0100.08320.11
7.0.30.0300.05020.17
7.0.20.0330.04720.42
7.0.10.0070.04020.35
7.0.00.0000.04720.30
5.6.280.0030.04721.15
5.6.210.0130.08320.74
5.6.200.0130.07718.19
5.6.190.0130.08020.66
5.6.180.0270.05020.69
5.6.170.0300.07720.47
5.6.160.0070.04320.47
5.6.150.0100.07318.23
5.6.140.0030.04018.15
5.6.130.0100.03718.36
5.6.120.0130.05321.20
5.6.110.0030.08321.16
5.6.100.0030.08321.24
5.6.90.0170.05721.04
5.6.80.0130.06720.35
5.5.350.0030.04720.36
5.5.340.0170.07318.02
5.5.330.0130.07320.57
5.5.320.0670.06720.35
5.5.310.0200.04020.38
5.5.300.0000.06017.94
5.5.290.0100.07717.99
5.5.280.0100.08320.91
5.5.270.0030.09020.96
5.5.260.0000.04320.70
5.5.250.0000.09320.72
5.5.240.0130.07720.30

preferences:
50.38 ms | 401 KiB | 5 Q