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"); 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, $pass, $salt) { $derived = PBKDF1($pass, $salt, 100, 48); $key = bin2hex(substr($derived, 0, 32)); $iv = bin2hex(substr($derived, 32, 16)); return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext, MCRYPT_MODE_CBC, $iv)); } function PBKDF2($pass, $salt, $count, $dklen) { $t = $pass.$salt; $t = sha1($t, true); for($i=2; $i <= $count; $i++) { $t = sha1($t, true); } $t = substr($t,0,$dklen-1); return $t; } 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.63
8.3.50.0140.00521.17
8.3.40.0040.01218.86
8.3.30.0150.00318.69
8.3.20.0050.00220.33
8.3.10.0040.00423.48
8.3.00.0030.00523.67
8.2.180.0130.01018.66
8.2.170.0040.01122.96
8.2.160.0070.00720.35
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0080.00019.77
8.2.120.0030.00526.35
8.2.110.0040.00722.25
8.2.100.0060.00617.84
8.2.90.0040.00417.97
8.2.80.0090.00019.16
8.2.70.0050.00518.16
8.2.60.0070.00318.04
8.2.50.0030.00618.10
8.2.40.0050.00320.47
8.2.30.0040.00420.76
8.2.20.0040.00417.94
8.2.10.0040.00418.25
8.2.00.0050.00318.10
8.1.280.0150.00325.92
8.1.270.0030.00522.13
8.1.260.0030.00628.09
8.1.250.0090.00028.09
8.1.240.0030.00623.79
8.1.230.0060.00622.66
8.1.220.0080.00018.01
8.1.210.0000.00818.80
8.1.200.0080.00017.48
8.1.190.0080.00017.13
8.1.180.0000.00918.10
8.1.170.0060.00318.78
8.1.160.0000.00722.08
8.1.150.0030.00618.95
8.1.140.0030.00619.65
8.1.130.0040.00417.82
8.1.120.0040.00417.56
8.1.110.0030.00517.45
8.1.100.0060.00317.35
8.1.90.0070.00017.49
8.1.80.0030.00617.49
8.1.70.0070.00017.51
8.1.60.0000.00817.62
8.1.50.0030.00617.41
8.1.40.0000.00817.57
8.1.30.0000.00817.69
8.1.20.0040.00417.67
8.1.10.0000.00817.64
8.1.00.0000.00817.59
8.0.300.0040.00422.08
8.0.290.0080.00016.88
8.0.280.0000.00818.55
8.0.270.0030.00317.34
8.0.260.0070.00017.20
8.0.250.0000.00717.10
8.0.240.0040.00417.15
8.0.230.0000.00817.06
8.0.220.0000.00716.99
8.0.210.0050.00316.95
8.0.200.0070.00017.07
8.0.190.0060.00317.04
8.0.180.0000.00717.02
8.0.170.0030.00617.05
8.0.160.0070.00016.98
8.0.150.0040.00417.09
8.0.140.0050.00316.99
8.0.130.0000.00713.39
8.0.120.0060.00317.01
8.0.110.0000.00716.98
8.0.100.0000.00817.05
8.0.90.0040.00417.14
8.0.80.0090.00616.95
8.0.70.0040.00416.82
8.0.60.0040.00416.84
8.0.50.0040.00416.88
8.0.30.0090.01217.25
8.0.20.0120.00617.41
8.0.10.0060.00317.19
8.0.00.0080.01016.98
7.4.330.0000.00516.67
7.4.320.0030.00316.48
7.4.300.0000.00716.50
7.4.290.0000.00816.68
7.4.280.0070.00316.54
7.4.270.0030.00316.55
7.4.260.0000.00816.66
7.4.250.0030.00516.64
7.4.240.0060.00116.65
7.4.230.0040.00416.70
7.4.220.0210.00916.59
7.4.210.0070.00816.57
7.4.200.0000.00816.51
7.4.160.0030.01316.59
7.4.150.0140.00317.40
7.4.140.0130.00817.86
7.4.130.0070.01316.61
7.4.120.0110.00616.52
7.4.110.0140.00416.68
7.4.100.0110.00716.52
7.4.90.0160.00316.68
7.4.80.0030.01419.39
7.4.70.0040.01116.65
7.4.60.0100.01316.50
7.4.50.0070.00716.25
7.4.40.0030.01316.61
7.4.30.0120.00916.45
7.4.00.0040.01214.94
7.3.330.0050.00013.52
7.3.320.0030.00313.27
7.3.310.0000.00816.26
7.3.300.0070.00016.45
7.3.290.0040.00416.40
7.3.280.0090.01116.47
7.3.270.0140.00617.40
7.3.260.0070.01016.65
7.3.250.0110.00816.51
7.3.240.0050.01116.58
7.3.230.0150.00916.73
7.3.210.0110.00616.44
7.3.200.0070.01716.70
7.3.190.0090.00916.67
7.3.180.0080.00816.58
7.3.170.0080.00816.75
7.3.160.0100.01316.48
7.3.10.0000.01416.68
7.3.00.0080.00816.38
7.2.330.0110.00716.81
7.2.320.0070.01016.49
7.2.310.0120.00816.55
7.2.300.0130.00616.76
7.2.290.0090.00616.70
7.2.130.0080.00816.85
7.2.120.0000.01416.83
7.2.110.0050.01216.69
7.2.100.0030.00916.58
7.2.90.0100.00616.58
7.2.80.0090.00916.90
7.2.70.0070.00316.50
7.2.60.0050.01116.78
7.2.50.0000.01816.85
7.2.40.0030.01516.79
7.2.30.0090.00616.84
7.2.20.0040.00716.73
7.2.10.0040.01116.77
7.2.00.0040.01018.11
7.1.250.0040.01215.56
7.1.200.0060.00315.82
7.1.100.0030.00518.00
7.1.70.0000.00717.08
7.1.60.0110.01519.06
7.1.50.0160.01334.55
7.1.00.0100.07022.30
7.0.200.0090.00615.15
7.0.60.0000.04321.63
7.0.50.0030.06718.06
7.0.40.0030.05320.29
7.0.30.0270.04020.28
7.0.20.0230.08320.07
7.0.10.0000.04720.07
7.0.00.0070.04020.09
5.6.280.0030.03721.02
5.6.210.0030.06320.59
5.6.200.0000.08318.16
5.6.190.0000.04720.69
5.6.180.0230.05020.34
5.6.170.0170.05020.53
5.6.160.0100.08320.71
5.6.150.0000.05318.22
5.6.140.0100.05718.35
5.6.130.0070.07018.28
5.6.120.0100.07021.04
5.6.110.0130.07721.07
5.6.100.0070.06021.14
5.6.90.0170.08021.04
5.6.80.0030.05720.33
5.5.350.0030.06720.47
5.5.340.0070.05318.09
5.5.330.0030.06720.48
5.5.320.0630.07020.28
5.5.310.0170.04020.36
5.5.300.0030.07318.02
5.5.290.0070.06017.96
5.5.280.0070.08320.98
5.5.270.0100.06320.89
5.5.260.0030.05020.93
5.5.250.0100.07720.63
5.5.240.0100.06020.43

preferences:
63.7 ms | 401 KiB | 5 Q