3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dec = Decrypt("wpdPVWejqNRYqDTeUJ2Iw3HWdb4HnyK2FYF679T3oFU=", "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 = PBKDF2($password, $salt, 100, 32); $iv = PBKDF2($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.40.0120.00318.79
8.3.30.0120.00318.71
8.3.20.0080.00020.17
8.3.10.0040.00423.46
8.3.00.0040.00423.48
8.2.170.0110.00719.07
8.2.160.0130.01022.96
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0040.00419.76
8.2.120.0030.00626.35
8.2.110.0050.00522.25
8.2.100.0060.00617.93
8.2.90.0080.00019.26
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0030.00617.92
8.2.50.0080.00018.07
8.2.40.0080.00022.16
8.2.30.0040.00420.67
8.2.20.0030.00617.93
8.2.10.0090.00018.14
8.2.00.0030.00518.14
8.1.270.0090.00022.18
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00023.84
8.1.230.0110.00019.16
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0030.00717.48
8.1.190.0000.00817.60
8.1.180.0040.00418.10
8.1.170.0030.00518.70
8.1.160.0000.00820.89
8.1.150.0050.00318.93
8.1.140.0070.00419.54
8.1.130.0030.00317.76
8.1.120.0030.00617.57
8.1.110.0040.00417.40
8.1.100.0040.00417.53
8.1.90.0080.00017.34
8.1.80.0030.00617.55
8.1.70.0070.00017.50
8.1.60.0000.00817.59
8.1.50.0000.00817.49
8.1.40.0050.00317.48
8.1.30.0050.00317.67
8.1.20.0000.00917.70
8.1.10.0050.00317.63
8.1.00.0000.00817.43
8.0.300.0070.00018.77
8.0.290.0000.00716.88
8.0.280.0030.00618.41
8.0.270.0050.00317.31
8.0.260.0030.00317.21
8.0.250.0070.00017.00
8.0.240.0070.00017.14
8.0.230.0030.00317.11
8.0.220.0040.00416.92
8.0.210.0050.00316.95
8.0.200.0000.00716.96
8.0.190.0070.00317.01
8.0.180.0000.00716.94
8.0.170.0050.00217.10
8.0.160.0030.00616.95
8.0.150.0000.00716.91
8.0.140.0000.00716.98
8.0.130.0000.00613.48
8.0.120.0060.00317.02
8.0.110.0000.00917.03
8.0.100.0040.00417.04
8.0.90.0070.00017.06
8.0.80.0030.02016.99
8.0.70.0000.00716.89
8.0.60.0000.00816.93
8.0.50.0040.00416.88
8.0.30.0100.00717.07
8.0.20.0170.00517.40
8.0.10.0070.00317.09
8.0.00.0090.01116.81
7.4.330.0020.00216.74
7.4.320.0040.00416.56
7.4.300.0000.00616.57
7.4.290.0000.00716.61
7.4.280.0000.00916.61
7.4.270.0000.00816.57
7.4.260.0000.00716.67
7.4.250.0040.00416.63
7.4.240.0030.00416.58
7.4.230.0000.00816.48
7.4.220.0090.01216.68
7.4.210.0120.00316.57
7.4.200.0040.00416.55
7.4.160.0120.00416.41
7.4.150.0040.01517.40
7.4.140.0080.01517.86
7.4.130.0150.00716.71
7.4.120.0080.01416.53
7.4.110.0100.00716.42
7.4.100.0190.00316.76
7.4.90.0060.01216.67
7.4.80.0120.00716.58
7.4.70.0060.00916.64
7.4.60.0030.01616.71
7.4.50.0040.01116.50
7.4.40.0070.01016.44
7.4.30.0080.00916.56
7.4.10.0030.01614.84
7.4.00.0080.01015.12
7.3.330.0000.00513.49
7.3.320.0030.00313.31
7.3.310.0030.00516.52
7.3.300.0000.00716.36
7.3.290.0000.00716.52
7.3.280.0080.00916.44
7.3.270.0050.01317.40
7.3.260.0080.00916.68
7.3.250.0110.00716.48
7.3.240.0090.00816.60
7.3.230.0120.00616.52
7.3.210.0100.00716.64
7.3.200.0040.01316.54
7.3.190.0060.01116.50
7.3.180.0140.00316.55
7.3.170.0060.01016.44
7.3.160.0090.01416.43
7.3.130.0030.01315.07
7.3.120.0070.01114.95
7.3.110.0030.01714.81
7.3.100.0030.01215.08
7.3.90.0070.01314.98
7.3.80.0060.00614.91
7.3.70.0070.00314.98
7.3.60.0070.00714.98
7.3.50.0060.00914.83
7.3.40.0040.00414.77
7.3.30.0040.01115.01
7.3.20.0030.01616.82
7.3.10.0070.00316.79
7.3.00.0030.00616.82
7.2.330.0160.00716.85
7.2.320.0060.01216.76
7.2.310.0000.01616.55
7.2.300.0060.01216.72
7.2.290.0090.00816.73
7.2.260.0060.01215.45
7.2.250.0060.01315.34
7.2.240.0080.00815.16
7.2.230.0000.01215.20
7.2.220.0060.00915.11
7.2.210.0100.00314.94
7.2.200.0040.01114.98
7.2.190.0040.01114.86
7.2.180.0090.00915.14
7.2.170.0090.00615.32
7.2.160.0030.01315.12
7.2.150.0040.00816.97
7.2.140.0080.00416.88
7.2.130.0000.01517.00
7.2.120.0000.01416.91
7.2.110.0060.00916.88
7.2.100.0070.00717.05
7.2.90.0030.01017.09
7.2.80.0000.01816.79
7.2.70.0110.00716.70
7.2.60.0030.01316.79
7.2.50.0030.01317.07
7.2.40.0140.00017.03
7.2.30.0030.01016.92
7.2.20.0070.00316.80
7.2.10.0100.00716.90
7.2.00.0040.00918.19
7.1.330.0030.01015.72
7.1.320.0070.00715.63
7.1.310.0070.00715.76
7.1.300.0090.00615.82
7.1.290.0030.00615.81
7.1.280.0030.01015.88
7.1.270.0070.00715.82
7.1.260.0030.01015.80
7.1.250.0000.00915.88
7.1.240.0030.01215.82
7.1.230.0090.00615.89
7.1.220.0030.00915.78
7.1.210.0050.00515.71
7.1.200.0030.01115.66
7.1.190.0070.00715.75
7.1.180.0030.00615.97
7.1.170.0060.00615.49
7.1.160.0030.01015.54
7.1.150.0060.01015.77
7.1.140.0030.01315.96
7.1.130.0080.00415.83
7.1.120.0030.01015.77
7.1.110.0070.00715.84
7.1.100.0090.00316.98
7.1.90.0110.00415.70
7.1.80.0070.00716.00
7.1.70.0050.00916.54
7.1.60.0120.00717.41
7.1.50.0050.01116.27
7.1.40.0060.00615.78
7.1.30.0070.00715.59
7.1.20.0040.00715.95
7.1.10.0030.01015.51
7.1.00.0060.04319.21
7.0.330.0080.00415.10
7.0.320.0000.01315.40
7.0.310.0040.01115.44
7.0.300.0000.01215.42
7.0.290.0000.01315.39
7.0.280.0000.01115.60
7.0.270.0060.00915.35
7.0.260.0030.01015.33
7.0.250.0000.00815.47
7.0.240.0000.01615.51
7.0.230.0080.00515.42
7.0.220.0070.00315.60
7.0.210.0000.01215.15
7.0.200.0050.01114.98
7.0.190.0090.00315.27
7.0.180.0030.00915.54
7.0.170.0040.01115.57
7.0.160.0000.00815.37
7.0.150.0060.00615.43
7.0.140.0040.01115.29
7.0.130.0110.00415.39
7.0.120.0060.00915.55
7.0.110.0040.00915.57
7.0.100.0030.01015.56
7.0.90.0100.00315.56
7.0.80.0040.00415.15
7.0.70.0110.00315.54
7.0.60.0050.02018.56
7.0.50.0080.04016.75
7.0.40.0120.04216.74
7.0.30.0160.03317.01
7.0.20.0250.03716.84
7.0.10.0050.04816.83
7.0.00.0050.02316.91
5.6.400.0100.00314.69
5.6.390.0100.00314.61
5.6.380.0040.00714.38
5.6.370.0040.00814.50
5.6.360.0070.00714.55
5.6.350.0030.00614.02
5.6.340.0040.01114.41
5.6.330.0090.00614.60
5.6.320.0060.00614.60
5.6.310.0090.00414.71
5.6.300.0070.00713.95
5.6.290.0030.01014.34
5.6.280.0020.03617.75
5.6.270.0060.00614.71
5.6.260.0040.01114.64
5.6.250.0030.01014.30
5.6.240.0120.00314.29
5.6.230.0000.01114.21
5.6.220.0000.01214.50
5.6.210.0050.04017.63
5.6.200.0070.02016.25
5.6.190.0050.05017.30
5.6.180.0170.04217.35
5.6.170.0130.04117.49
5.6.160.0050.02317.34
5.6.150.0070.03016.31
5.6.140.0090.04216.23
5.6.130.0070.02916.23
5.6.120.0070.02517.71
5.6.110.0020.05117.75
5.6.100.0050.02317.56
5.6.90.0080.04317.93
5.6.80.0120.03717.57
5.6.70.0040.01114.36
5.6.60.0000.00814.09
5.6.50.0070.00314.34
5.6.40.0120.00614.50
5.6.30.0070.01014.30
5.6.20.0080.00014.23
5.6.10.0030.00814.33
5.6.00.0070.00414.18
5.5.380.0090.00014.29
5.5.370.0000.00913.86
5.5.360.0040.01114.14
5.5.350.0030.04917.24
5.5.340.0110.04016.21
5.5.330.0100.04317.43
5.5.320.0260.03117.44
5.5.310.0190.03917.24
5.5.300.0070.04616.03
5.5.290.0070.04316.15
5.5.280.0080.04317.54
5.5.270.0060.03317.48
5.5.260.0000.02617.65
5.5.250.0050.04317.58
5.5.240.0190.03817.20
5.5.230.0030.01214.18
5.5.220.0030.00914.31
5.5.210.0060.00914.26
5.5.200.0070.00714.20
5.5.190.0060.00914.23
5.5.180.0090.00414.44
5.5.170.0030.00514.21
5.5.160.0090.00314.10
5.5.150.0040.00414.39
5.5.140.0130.00014.09
5.5.130.0070.00714.04
5.5.120.0100.00714.00
5.5.110.0040.01113.98
5.5.100.0040.01114.17
5.5.90.0070.01114.40
5.5.80.0030.01413.81
5.5.70.0080.00814.10
5.5.60.0060.01314.38
5.5.50.0040.01314.23
5.5.40.0080.00614.24
5.5.30.0060.00614.22
5.5.20.0040.01114.08
5.5.10.0070.00314.37
5.5.00.0030.00913.86

preferences:
55.03 ms | 400 KiB | 5 Q