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); $block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC); $padding = $block - (strlen($ciphertext) % $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.0090.00616.75
8.3.50.0140.00521.28
8.3.40.0090.01318.67
8.3.30.0040.01118.92
8.3.20.0040.00420.34
8.3.10.0050.00323.48
8.3.00.0080.00023.48
8.2.180.0100.01018.29
8.2.170.0120.00322.96
8.2.160.0070.00720.35
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.01018.09
8.2.120.0050.00326.35
8.2.110.0030.00622.27
8.2.100.0080.00418.05
8.2.90.0050.00319.20
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0040.00418.04
8.2.50.0030.00618.07
8.2.40.0080.00022.27
8.2.30.0050.00220.67
8.2.20.0080.00017.83
8.2.10.0000.00718.07
8.2.00.0050.00318.07
8.1.280.0100.01025.92
8.1.270.0120.00322.05
8.1.260.0000.00828.09
8.1.250.0050.00328.09
8.1.240.0060.00323.99
8.1.230.0040.00819.16
8.1.220.0040.00417.79
8.1.210.0080.00018.77
8.1.200.0090.00017.36
8.1.190.0050.00317.48
8.1.180.0050.00318.10
8.1.170.0040.00418.46
8.1.160.0040.00420.80
8.1.150.0040.00418.84
8.1.140.0030.00619.55
8.1.130.0030.00617.74
8.1.120.0040.00417.57
8.1.110.0040.00417.32
8.1.100.0040.00417.55
8.1.90.0050.00217.43
8.1.80.0030.00617.50
8.1.70.0040.00417.45
8.1.60.0000.00917.58
8.1.50.0040.00417.39
8.1.40.0050.00317.55
8.1.30.0040.00417.61
8.1.20.0040.00417.61
8.1.10.0040.00417.48
8.1.00.0000.00917.56
8.0.300.0040.00418.77
8.0.290.0000.00716.75
8.0.280.0070.00018.58
8.0.270.0070.00017.29
8.0.260.0070.00017.29
8.0.250.0000.00817.06
8.0.240.0060.00017.08
8.0.230.0000.00717.00
8.0.220.0040.00417.01
8.0.210.0080.00017.00
8.0.200.0060.00016.94
8.0.190.0000.00717.05
8.0.180.0000.00817.04
8.0.170.0050.00316.95
8.0.160.0000.00816.91
8.0.150.0040.00416.98
8.0.140.0000.00716.83
8.0.130.0000.00713.41
8.0.120.0060.00316.97
8.0.110.0040.00416.83
8.0.100.0080.00017.01
8.0.90.0000.00716.87
8.0.80.0070.00717.04
8.0.70.0050.00316.97
8.0.60.0040.00416.78
8.0.50.0040.00417.01
8.0.30.0100.01016.97
8.0.20.0050.01317.40
8.0.10.0040.00417.09
8.0.00.0040.01516.90
7.4.330.0050.00016.76
7.4.320.0030.00316.63
7.4.300.0000.00616.45
7.4.290.0000.00716.54
7.4.280.0070.00316.44
7.4.270.0030.00316.54
7.4.260.0050.00516.63
7.4.250.0000.00716.46
7.4.240.0010.00616.50
7.4.230.0040.00416.43
7.4.220.0130.00616.66
7.4.210.0110.00416.66
7.4.200.0040.00416.75
7.4.160.0070.01016.51
7.4.150.0170.00417.40
7.4.140.0140.00717.86
7.4.130.0120.00616.62
7.4.120.0130.00516.58
7.4.110.0060.01216.49
7.4.100.0030.01516.64
7.4.90.0090.00916.63
7.4.80.0030.01319.39
7.4.70.0130.00316.62
7.4.60.0000.01616.55
7.4.50.0070.01016.52
7.4.40.0130.00816.61
7.4.30.0100.00716.41
7.4.10.0090.00815.01
7.4.00.0070.01114.96
7.3.330.0030.00313.31
7.3.320.0030.00313.48
7.3.310.0030.00316.41
7.3.300.0000.00716.45
7.3.290.0070.00016.46
7.3.280.0090.00816.47
7.3.270.0120.00417.40
7.3.260.0090.00916.64
7.3.250.0110.01016.46
7.3.240.0040.01416.66
7.3.230.0110.00716.66
7.3.210.0140.00316.70
7.3.200.0110.00719.39
7.3.190.0110.00616.68
7.3.180.0120.01216.70
7.3.170.0080.00816.51
7.3.160.0080.00816.41
7.3.130.0020.01714.94
7.3.120.0070.01114.82
7.3.110.0080.01015.01
7.3.100.0020.01114.84
7.3.90.0050.00615.00
7.3.80.0060.00814.94
7.3.70.0080.00614.74
7.3.60.0050.00915.03
7.3.50.0020.01314.90
7.3.40.0030.00814.85
7.3.30.0060.00714.92
7.3.20.0030.01016.68
7.3.10.0060.00616.42
7.3.00.0070.00816.68
7.2.330.0150.00316.73
7.2.320.0170.00016.79
7.2.310.0180.00616.55
7.2.300.0130.00916.86
7.2.290.0200.00316.61
7.2.260.0090.00915.22
7.2.250.0080.00915.17
7.2.240.0130.00115.14
7.2.230.0020.01315.30
7.2.220.0050.00815.15
7.2.210.0030.01014.89
7.2.200.0070.00715.18
7.2.190.0050.00614.99
7.2.180.0060.00415.16
7.2.170.0120.00515.06
7.2.160.0060.00615.28
7.2.150.0050.00516.74
7.2.140.0070.00816.84
7.2.130.0050.01016.88
7.2.120.0070.00716.88
7.2.110.0090.00716.74
7.2.100.0030.00916.96
7.2.90.0060.01417.01
7.2.80.0020.01617.06
7.2.70.0070.00616.84
7.2.60.0070.00916.98
7.2.50.0000.01316.84
7.2.40.0050.00917.06
7.2.30.0040.01016.87
7.2.20.0110.00016.95
7.2.10.0040.00616.81
7.2.00.0060.00617.75
7.1.330.0070.00715.86
7.1.320.0060.00615.82
7.1.310.0090.00615.76
7.1.300.0040.00915.68
7.1.290.0010.00915.86
7.1.280.0060.00616.00
7.1.270.0000.01115.79
7.1.260.0060.00815.76
7.1.250.0050.00715.73
7.1.240.0030.00815.72
7.1.230.0040.00815.83
7.1.220.0050.00915.83
7.1.210.0080.00515.74
7.1.200.0060.00915.72
7.1.190.0050.00915.85
7.1.180.0120.00315.84
7.1.170.0110.00415.77
7.1.160.0080.00315.83
7.1.150.0060.00715.77
7.1.140.0050.01015.80
7.1.130.0050.00815.83
7.1.120.0020.01215.74
7.1.110.0020.01215.93
7.1.100.0040.00716.72
7.1.90.0050.00915.86
7.1.80.0030.00815.90
7.1.70.0030.00616.38
7.1.60.0080.00916.94
7.1.50.0050.01216.23
7.1.40.0070.00515.51
7.1.30.0090.00515.78
7.1.20.0050.00915.70
7.1.10.0020.01215.83
7.1.00.0060.02717.97
7.0.330.0030.01115.41
7.0.320.0050.01015.39
7.0.310.0060.00415.50
7.0.300.0060.00415.21
7.0.290.0020.00815.55
7.0.280.0030.01015.39
7.0.270.0030.00715.43
7.0.260.0040.00815.50
7.0.250.0040.00615.33
7.0.240.0060.00615.39
7.0.230.0060.00815.43
7.0.220.0020.01015.51
7.0.210.0050.00915.51
7.0.200.0100.00415.26
7.0.190.0020.00815.46
7.0.180.0020.01215.50
7.0.170.0050.00915.32
7.0.160.0050.01015.36
7.0.150.0040.00915.44
7.0.140.0010.01215.37
7.0.130.0030.01015.49
7.0.120.0050.00515.44
7.0.110.0080.00815.47
7.0.100.0030.01015.49
7.0.90.0060.00515.50
7.0.80.0070.00315.48
7.0.70.0070.00715.55
7.0.60.0090.03017.51
7.0.50.0040.03516.39
7.0.40.0070.02115.70
7.0.30.0120.02715.79
7.0.20.0170.02615.74
7.0.10.0060.03215.74
7.0.00.0050.02015.77
5.6.400.0030.00914.45
5.6.390.0080.00514.55
5.6.380.0020.01514.39
5.6.370.0060.00314.52
5.6.360.0050.01114.44
5.6.350.0060.00714.61
5.6.340.0050.00614.47
5.6.330.0070.00714.29
5.6.320.0060.00514.67
5.6.310.0100.00314.38
5.6.300.0050.00914.52
5.6.290.0050.00814.14
5.6.280.0060.02216.61
5.6.270.0060.00714.43
5.6.260.0090.00714.44
5.6.250.0120.00414.42
5.6.240.0060.00414.35
5.6.230.0060.00814.24
5.6.220.0120.00614.25
5.6.210.0030.02016.47
5.6.200.0050.02715.66
5.6.190.0070.03516.41
5.6.180.0130.01716.51
5.6.170.0100.02416.38
5.6.160.0060.02216.54
5.6.150.0030.03415.64
5.6.140.0080.02915.63
5.6.130.0080.02115.71
5.6.120.0090.03116.61
5.6.110.0040.02816.61
5.6.100.0030.02316.57
5.6.90.0080.02716.65
5.6.80.0060.01816.41
5.6.70.0060.00614.44
5.6.60.0000.01214.35
5.6.50.0050.00814.46
5.6.40.0030.01214.20
5.6.30.0080.00714.41
5.6.20.0020.01314.27
5.6.10.0090.00414.21
5.6.00.0040.00814.23
5.5.380.0060.00914.28
5.5.370.0060.00614.57
5.5.360.0070.00714.18
5.5.350.0040.03416.32
5.5.340.0090.02115.36
5.5.330.0070.03016.35
5.5.320.0190.02316.27
5.5.310.0110.02316.58
5.5.300.0030.02915.68
5.5.290.0040.03415.79
5.5.280.0070.03016.62
5.5.270.0100.02116.49
5.5.260.0110.02716.38
5.5.250.0080.03016.54
5.5.240.0050.03216.30
5.5.230.0030.01014.21
5.5.220.0030.00914.49
5.5.210.0070.00614.45
5.5.200.0020.01114.36
5.5.190.0020.01214.41
5.5.180.0090.00614.11
5.5.170.0070.00314.31
5.5.160.0100.00614.34
5.5.150.0070.00914.19
5.5.140.0020.01414.04
5.5.130.0070.00714.40
5.5.120.0070.00514.51
5.5.110.0020.01314.37
5.5.100.0090.00414.29
5.5.90.0080.00514.08
5.5.80.0080.00714.10
5.5.70.0110.00514.18
5.5.60.0050.01014.34
5.5.50.0030.00814.28
5.5.40.0040.00914.19
5.5.30.0060.00514.36
5.5.20.0040.00614.25
5.5.10.0050.00814.32
5.5.00.0060.00514.08

preferences:
46.05 ms | 401 KiB | 5 Q