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); $decpad = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $ciphertext, MCRYPT_MODE_CBC, $iv); $pad = ord($decpad[($len = strlen($decpad)) - 1]); $dec = substr($decpad, 0, strlen($decpad) - $pad); return base64_encode($dec); } 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.0070.01116.63
8.3.60.0000.01516.75
8.3.50.0110.00921.16
8.3.40.0090.00618.82
8.3.30.0040.01218.76
8.3.20.0020.00520.39
8.3.10.0040.00423.54
8.3.00.0080.00023.84
8.2.190.0090.00618.49
8.2.180.0090.00916.75
8.2.170.0120.00319.09
8.2.160.0140.00022.96
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0070.00318.03
8.2.120.0030.00626.35
8.2.110.0060.00319.33
8.2.100.0060.00618.05
8.2.90.0030.00619.21
8.2.80.0080.00018.03
8.2.70.0060.00317.73
8.2.60.0000.00817.93
8.2.50.0000.00818.07
8.2.40.0080.00022.13
8.2.30.0040.00420.64
8.2.20.0040.00417.89
8.2.10.0020.00518.16
8.2.00.0040.00418.04
8.1.280.0140.00725.92
8.1.270.0060.01522.11
8.1.260.0030.00728.09
8.1.250.0060.00328.09
8.1.240.0030.00620.80
8.1.230.0120.00019.09
8.1.220.0000.00917.79
8.1.210.0060.00318.77
8.1.200.0000.01017.38
8.1.190.0030.00617.36
8.1.180.0060.00318.10
8.1.170.0000.00818.71
8.1.160.0070.00020.79
8.1.150.0040.00418.84
8.1.140.0080.00419.67
8.1.130.0040.00417.66
8.1.120.0030.00417.47
8.1.110.0030.00617.53
8.1.100.0050.00217.48
8.1.90.0060.00317.51
8.1.80.0000.01017.39
8.1.70.0030.00517.49
8.1.60.0030.00617.67
8.1.50.0030.00617.46
8.1.40.0000.00817.62
8.1.30.0060.00317.66
8.1.20.0030.00617.73
8.1.10.0040.00417.50
8.1.00.0040.00417.62
8.0.300.0080.00018.77
8.0.290.0000.00716.75
8.0.280.0050.00318.54
8.0.270.0000.00717.34
8.0.260.0070.00017.33
8.0.250.0030.00317.02
8.0.240.0040.00417.03
8.0.230.0030.00317.10
8.0.220.0040.00416.96
8.0.210.0050.00217.03
8.0.200.0040.00417.05
8.0.190.0000.00817.08
8.0.180.0040.00416.92
8.0.170.0080.00016.96
8.0.160.0040.00417.07
8.0.150.0070.00016.96
8.0.140.0000.00716.94
8.0.130.0030.00313.41
8.0.120.0040.00416.95
8.0.110.0000.00716.93
8.0.100.0040.00417.03
8.0.90.0050.00316.88
8.0.80.0060.01017.05
8.0.70.0000.00716.98
8.0.60.0000.00716.82
8.0.50.0040.00417.07
8.0.30.0080.00917.07
8.0.20.0110.00817.40
8.0.10.0080.00017.16
8.0.00.0070.01216.90
7.4.330.0050.00016.77
7.4.320.0060.00016.64
7.4.300.0000.00616.72
7.4.290.0040.00416.44
7.4.280.0050.00516.52
7.4.270.0050.00216.55
7.4.260.0050.00516.48
7.4.250.0000.00716.63
7.4.240.0030.00416.48
7.4.230.0000.00716.62
7.4.220.0070.01716.59
7.4.210.0070.00816.63
7.4.200.0000.00716.43
7.4.150.0190.00417.40
7.4.140.0100.01217.86
7.4.130.0100.00816.72
7.4.120.0090.00916.50
7.4.110.0110.00716.48
7.4.100.0070.01416.49
7.4.90.0090.00916.68
7.4.80.0100.00819.39
7.4.70.0180.00016.73
7.4.60.0100.00716.34
7.4.50.0060.01216.70
7.4.40.0050.01616.65
7.4.30.0100.01016.54
7.4.00.0060.01114.87
7.3.330.0000.00513.23
7.3.320.0000.00513.45
7.3.310.0040.00416.48
7.3.300.0040.00416.47
7.3.290.0040.00416.47
7.3.280.0080.01016.45
7.3.270.0080.00817.40
7.3.260.0120.01216.62
7.3.250.0090.01116.48
7.3.240.0090.01316.45
7.3.230.0140.00516.45
7.3.210.0060.01016.59
7.3.200.0090.00919.39
7.3.190.0130.00316.67
7.3.180.0080.00816.49
7.3.170.0130.00316.43
7.3.160.0090.01316.62
7.3.120.0030.01514.81
7.3.110.0080.00614.98
7.3.100.0040.01114.87
7.3.90.0050.00914.89
7.3.80.0090.00414.86
7.3.70.0050.01114.96
7.3.60.0070.00515.03
7.3.50.0040.00914.92
7.3.40.0060.00814.78
7.3.30.0020.01114.78
7.3.20.0020.01116.68
7.3.10.0070.00716.59
7.3.00.0040.00816.63
7.2.330.0070.01016.82
7.2.320.0100.00716.51
7.2.310.0040.01216.70
7.2.300.0100.01316.87
7.2.290.0160.00616.84
7.2.250.0090.00715.16
7.2.240.0120.00815.21
7.2.230.0080.00615.09
7.2.220.0120.00515.17
7.2.210.0100.00515.02
7.2.200.0100.00715.16
7.2.190.0060.00315.04
7.2.180.0060.00814.99
7.2.170.0070.00715.19
7.2.130.0030.01316.54
7.2.120.0090.00616.84
7.2.110.0070.00816.61
7.2.100.0070.01116.88
7.2.90.0120.00316.61
7.2.80.0030.00616.72
7.2.70.0040.00716.55
7.2.60.0100.00516.92
7.2.50.0050.00516.77
7.2.40.0090.00616.77
7.2.30.0100.00716.66
7.2.20.0090.00616.57
7.2.10.0060.00916.43
7.2.00.0040.01118.23
7.1.330.0100.00515.65
7.1.320.0090.00715.96
7.1.310.0040.00716.06
7.1.300.0070.00315.69
7.1.290.0050.00615.66
7.1.280.0040.00915.70
7.1.270.0060.00615.76
7.1.260.0030.00815.89
7.1.250.0030.01415.41
7.1.200.0000.01215.98
7.1.100.0000.01118.28
7.1.70.0030.00717.28
7.1.60.0160.01019.06
7.1.50.0090.00617.11
7.1.00.0030.07722.33
7.0.200.0240.01015.01
7.0.60.0100.06721.66
7.0.50.0030.04318.04
7.0.40.0070.09020.11
7.0.30.0200.08320.21
7.0.20.0370.04720.14
7.0.10.0100.08720.16
7.0.00.0070.09020.27
5.6.280.0030.06721.10
5.6.210.0070.08720.54
5.6.200.0070.08318.18
5.6.190.0070.08320.68
5.6.180.0170.04720.46
5.6.170.0270.08020.47
5.6.160.0100.08020.59
5.6.150.0100.05018.22
5.6.140.0170.04318.35
5.6.130.0070.06318.19
5.6.120.0030.06721.10
5.6.110.0070.08021.14
5.6.100.0130.04720.94
5.6.90.0170.06321.04
5.6.80.0070.08020.34
5.5.350.0030.06720.46
5.5.340.0000.09017.95
5.5.330.0070.08720.48
5.5.320.0570.05320.36
5.5.310.0130.04320.36
5.5.300.0130.07718.15
5.5.290.0070.07017.99
5.5.280.0000.04320.74
5.5.270.0030.08320.89
5.5.260.0030.09320.89
5.5.250.0070.08320.72
5.5.240.0200.06720.22

preferences:
43.34 ms | 401 KiB | 5 Q