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); echo "bb" . base64_encode($iv); // 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); echo "aa" . base64_encode($iv); 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.0000.01516.60
8.3.50.0120.01221.06
8.3.40.0000.01518.79
8.3.30.0070.00718.92
8.3.20.0040.00420.25
8.3.10.0080.00023.48
8.3.00.0000.00923.58
8.2.180.0060.00918.42
8.2.170.0120.00318.83
8.2.160.0040.01122.96
8.2.150.0070.00024.18
8.2.140.0030.00624.66
8.2.130.0000.00819.73
8.2.120.0050.00326.35
8.2.110.0090.00321.18
8.2.100.0080.00417.93
8.2.90.0040.00419.25
8.2.80.0050.00317.97
8.2.70.0000.00817.75
8.2.60.0080.00018.05
8.2.50.0100.00018.07
8.2.40.0050.00522.34
8.2.30.0040.00420.54
8.2.20.0040.00417.84
8.2.10.0040.00418.17
8.2.00.0000.00818.27
8.1.280.0160.00625.92
8.1.270.0050.00322.10
8.1.260.0000.01028.09
8.1.250.0040.00428.09
8.1.240.0030.01020.81
8.1.230.0120.00018.99
8.1.220.0050.00317.78
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0050.00317.23
8.1.180.0080.00018.10
8.1.170.0050.00318.57
8.1.160.0000.00720.77
8.1.150.0000.00818.84
8.1.140.0080.00319.62
8.1.130.0030.00317.71
8.1.120.0040.00417.50
8.1.110.0080.00017.48
8.1.100.0000.00817.39
8.1.90.0050.00317.58
8.1.80.0030.00617.48
8.1.70.0070.00017.50
8.1.60.0030.00517.67
8.1.50.0000.00817.34
8.1.40.0040.00417.60
8.1.30.0000.00917.64
8.1.20.0060.00317.59
8.1.10.0080.00017.64
8.1.00.0080.00017.47
8.0.300.0000.00818.77
8.0.290.0040.00416.75
8.0.280.0000.00718.50
8.0.270.0070.00017.31
8.0.260.0080.00017.30
8.0.250.0000.00717.06
8.0.240.0000.00717.11
8.0.230.0030.00317.08
8.0.220.0040.00416.91
8.0.210.0030.00316.99
8.0.200.0080.00016.96
8.0.190.0000.00717.02
8.0.180.0030.00617.03
8.0.170.0000.00817.03
8.0.160.0070.00017.05
8.0.150.0080.00017.00
8.0.140.0050.00216.93
8.0.130.0030.00313.39
8.0.120.0000.00816.99
8.0.110.0080.00017.05
8.0.100.0030.00516.91
8.0.90.0020.00516.89
8.0.80.0000.01517.02
8.0.70.0060.00317.00
8.0.60.0000.00816.94
8.0.50.0000.00717.02
8.0.30.0080.01117.24
8.0.20.0070.01117.40
8.0.10.0000.00817.14
8.0.00.0050.01516.88
7.4.330.0050.00016.73
7.4.320.0030.00316.64
7.4.300.0000.00616.66
7.4.290.0000.00716.55
7.4.280.0000.01016.54
7.4.270.0070.00016.57
7.4.260.0070.00316.53
7.4.250.0070.00016.64
7.4.240.0040.00416.60
7.4.230.0000.00716.66
7.4.220.0090.00916.66
7.4.210.0080.00616.59
7.4.200.0030.00316.51
7.4.160.0060.00916.64
7.4.150.0060.01217.40
7.4.140.0140.00717.86
7.4.130.0100.00716.59
7.4.120.0080.01116.72
7.4.110.0100.00716.45
7.4.100.0160.00316.86
7.4.90.0060.01316.49
7.4.80.0160.00519.39
7.4.70.0080.00816.51
7.4.60.0090.00916.63
7.4.50.0060.01116.64
7.4.40.0040.01516.48
7.4.30.0060.00916.43
7.4.10.0060.01215.13
7.4.00.0020.01714.93
7.3.330.0000.00613.42
7.3.320.0050.00013.33
7.3.310.0000.00716.48
7.3.300.0070.00016.28
7.3.290.0030.00316.35
7.3.280.0090.00616.45
7.3.270.0060.01217.40
7.3.260.0040.01316.73
7.3.250.0090.01016.53
7.3.240.0150.00716.59
7.3.230.0150.00916.64
7.3.210.0160.00316.58
7.3.200.0100.00719.39
7.3.190.0090.00916.48
7.3.180.0060.01616.43
7.3.170.0060.01616.58
7.3.160.0100.01316.44
7.3.130.0000.01714.95
7.3.120.0120.00414.81
7.3.110.0060.01314.84
7.3.100.0040.01114.96
7.3.90.0030.00615.15
7.3.80.0100.00014.84
7.3.70.0000.01414.98
7.3.60.0090.00614.89
7.3.50.0120.00314.86
7.3.40.0130.00314.64
7.3.30.0070.00714.67
7.3.20.0000.01216.57
7.3.10.0080.00816.87
7.3.00.0050.00516.66
7.2.330.0100.01016.64
7.2.320.0030.01416.77
7.2.310.0060.01616.79
7.2.300.0070.01716.79
7.2.290.0140.00316.75
7.2.260.0040.01515.30
7.2.250.0070.01115.11
7.2.240.0090.00615.35
7.2.230.0070.00715.38
7.2.220.0030.01014.95
7.2.210.0060.00915.36
7.2.200.0060.00914.88
7.2.190.0060.00615.17
7.2.180.0000.01015.18
7.2.170.0110.00415.00
7.2.160.0030.01014.89
7.2.150.0030.01216.94
7.2.140.0100.00616.74
7.2.130.0040.01116.85
7.2.120.0100.00716.90
7.2.110.0460.00316.71
7.2.100.0140.00017.04
7.2.90.0000.01517.04
7.2.80.0120.00616.91
7.2.70.0030.01716.90
7.2.60.0050.00816.87
7.2.50.0070.01016.80
7.2.40.0040.00817.03
7.2.30.0060.00616.95
7.2.20.0070.00716.73
7.2.10.0060.00916.65
7.2.00.0040.01018.03
7.1.330.0030.01015.95
7.1.320.0040.01415.86
7.1.310.0040.01115.73
7.1.300.0040.01115.57
7.1.290.0000.00915.89
7.1.280.0070.01015.66
7.1.270.0100.00315.71
7.1.260.0130.00015.74
7.1.250.0030.01015.67
7.1.240.0090.00615.90
7.1.230.0000.01515.64
7.1.220.0040.01115.53
7.1.210.0060.00315.89
7.1.200.0080.00515.72
7.1.190.0070.00315.85
7.1.180.0000.01315.54
7.1.170.0060.00615.84
7.1.160.0000.01015.99
7.1.150.0060.00915.87
7.1.140.0070.00715.93
7.1.130.0070.01015.82
7.1.120.0040.00816.01
7.1.110.0060.00615.60
7.1.100.0050.00816.96
7.1.90.0030.00615.61
7.1.80.0030.01015.70
7.1.70.0050.00416.49
7.1.60.0050.01017.37
7.1.50.0070.01016.27
7.1.40.0000.00915.71
7.1.30.0040.00715.61
7.1.20.0060.00615.95
7.1.10.0040.01115.45
7.1.00.0050.04219.27
7.0.330.0060.00915.63
7.0.320.0040.00715.50
7.0.310.0000.01715.48
7.0.300.0030.01015.60
7.0.290.0030.00715.40
7.0.280.0070.01015.52
7.0.270.0000.00915.21
7.0.260.0070.00715.10
7.0.250.0070.00415.51
7.0.240.0100.00315.46
7.0.230.0000.01015.61
7.0.220.0040.00415.30
7.0.210.0040.00815.48
7.0.200.0090.00415.15
7.0.190.0030.00915.54
7.0.180.0090.00615.55
7.0.170.0040.01115.57
7.0.160.0030.00515.41
7.0.150.0030.00915.40
7.0.140.0090.00615.35
7.0.130.0040.01215.42
7.0.120.0090.00615.32
7.0.110.0040.00715.46
7.0.100.0030.01015.54
7.0.90.0000.00915.41
7.0.80.0100.00615.32
7.0.70.0030.00715.39
7.0.60.0030.02818.42
7.0.50.0070.04516.78
7.0.40.0070.02816.71
7.0.30.0140.04616.88
7.0.20.0150.02616.66
7.0.10.0100.04316.92
7.0.00.0060.04416.71
5.6.400.0000.00913.98
5.6.390.0090.00014.46
5.6.380.0030.00614.52
5.6.370.0100.01014.35
5.6.360.0030.00614.43
5.6.350.0060.00914.41
5.6.340.0040.01114.48
5.6.330.0000.01014.70
5.6.320.0040.01114.62
5.6.310.0000.01314.63
5.6.300.0060.00314.07
5.6.290.0090.00614.40
5.6.280.0050.03317.81
5.6.270.0040.01014.21
5.6.260.0090.00614.55
5.6.250.0070.00714.32
5.6.240.0100.00614.41
5.6.230.0120.00814.55
5.6.220.0070.00714.49
5.6.210.0000.03017.51
5.6.200.0100.04116.29
5.6.190.0060.03017.53
5.6.180.0180.02117.51
5.6.170.0170.02717.52
5.6.160.0080.04417.51
5.6.150.0070.03016.37
5.6.140.0070.04216.26
5.6.130.0080.02316.38
5.6.120.0030.02817.71
5.6.110.0100.03917.81
5.6.100.0120.03917.84
5.6.90.0100.02917.72
5.6.80.0100.02317.38
5.6.70.0060.00914.42
5.6.60.0040.00714.25
5.6.50.0100.00314.23
5.6.40.0090.00614.41
5.6.30.0100.00014.50
5.6.20.0030.01014.32
5.6.10.0000.00814.38
5.6.00.0030.00614.66
5.5.380.0100.01014.36
5.5.370.0090.00614.56
5.5.360.0080.00514.22
5.5.350.0050.04017.34
5.5.340.0050.03116.12
5.5.330.0110.03817.40
5.5.320.0330.03517.32
5.5.310.0130.04417.24
5.5.300.0070.04216.19
5.5.290.0080.03916.08
5.5.280.0050.02417.58
5.5.270.0080.04517.46
5.5.260.0090.04317.45
5.5.250.0030.03817.54
5.5.240.0120.04217.32
5.5.230.0060.00614.34
5.5.220.0030.01014.15
5.5.210.0110.00314.23
5.5.200.0100.00614.18
5.5.190.0130.00314.03
5.5.180.0030.00814.38
5.5.170.0050.00314.17
5.5.160.0090.00614.49
5.5.150.0070.00714.15
5.5.140.0100.00614.09
5.5.130.0030.01214.37
5.5.120.0030.01014.49
5.5.110.0040.01114.45
5.5.100.0140.00014.11
5.5.90.0000.01114.45
5.5.80.0060.00614.29
5.5.70.0000.01514.38
5.5.60.0100.00313.91
5.5.50.0070.00714.25
5.5.40.0030.00914.51
5.5.30.0060.00914.44
5.5.20.0000.01014.45
5.5.10.0030.00613.88
5.5.00.0040.01114.27

preferences:
50.69 ms | 401 KiB | 5 Q