3v4l.org

run code in 300+ PHP versions simultaneously
<?php $enc = Encrypt("boy10@naver.com", "ICS2015", "7"); echo "Enc: " . $enc . "\r\n"; $dec = Decrypt("wpdPVWejqNRYqDTeUJ2Iw06/rnfHAoy5jtgTojiilD0=", "ICS2015", "7"); echo "Dec: " . $dec . "\r\n"; static $pp = ""; function Decrypt($ciphertext, $password, $salt) { $ciphertext = base64_decode($ciphertext); $key = PBKDF1($password, $salt, 100, 32); $iv = PBKDF1($password, $salt, 100, 16); $pp = $iv; echo "bb" . base64_encode($iv); echo "bb" . base64_encode($password); echo "bb" . base64_encode($salt); // 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($pp); echo "aa" . base64_encode($password); echo "aa" . base64_encode($salt); 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.0110.00416.75
8.3.50.0040.01116.50
8.3.40.0150.00018.99
8.3.30.0120.00918.73
8.3.20.0000.00720.18
8.3.10.0060.00323.62
8.3.00.0040.00423.53
8.2.180.0070.01118.38
8.2.170.0040.01119.08
8.2.160.0120.00322.96
8.2.150.0060.00624.18
8.2.140.0060.00324.66
8.2.130.0040.00419.71
8.2.120.0070.00326.35
8.2.110.0060.00320.93
8.2.100.0060.00617.91
8.2.90.0080.00018.02
8.2.80.0030.00517.97
8.2.70.0060.00317.75
8.2.60.0060.00318.03
8.2.50.0080.00018.07
8.2.40.0030.00622.38
8.2.30.0080.00020.59
8.2.20.0030.00517.77
8.2.10.0060.00318.16
8.2.00.0030.00618.08
8.1.280.0070.01425.92
8.1.270.0040.00422.14
8.1.260.0060.00628.09
8.1.250.0050.00328.09
8.1.240.0000.00922.66
8.1.230.0070.00720.91
8.1.220.0050.00317.74
8.1.210.0030.00618.77
8.1.200.0060.00317.35
8.1.190.0000.00817.25
8.1.180.0000.00918.10
8.1.170.0000.00818.55
8.1.160.0040.00420.80
8.1.150.0050.00318.91
8.1.140.0000.00819.52
8.1.130.0070.00017.65
8.1.120.0000.00717.52
8.1.110.0000.00817.49
8.1.100.0040.00417.51
8.1.90.0000.00817.43
8.1.80.0070.00317.46
8.1.70.0030.00317.46
8.1.60.0030.00617.60
8.1.50.0000.00817.47
8.1.40.0080.00017.45
8.1.30.0040.00417.65
8.1.20.0030.00617.54
8.1.10.0070.00017.63
8.1.00.0040.00417.52
8.0.300.0040.00420.03
8.0.290.0020.00517.00
8.0.280.0000.00718.48
8.0.270.0040.00417.21
8.0.260.0030.00317.21
8.0.250.0000.00717.07
8.0.240.0030.00316.98
8.0.230.0030.00317.02
8.0.220.0000.00717.05
8.0.210.0000.00817.04
8.0.200.0000.00717.09
8.0.190.0000.00917.09
8.0.180.0000.00716.92
8.0.170.0040.00416.93
8.0.160.0000.00716.93
8.0.150.0000.00716.90
8.0.140.0000.00716.89
8.0.130.0030.00313.42
8.0.120.0000.00816.94
8.0.110.0020.00517.00
8.0.100.0040.00416.88
8.0.90.0040.00416.95
8.0.80.0100.00917.02
8.0.70.0030.00516.88
8.0.60.0000.00816.94
8.0.50.0040.00416.88
8.0.30.0090.00817.24
8.0.20.0120.00717.40
8.0.10.0040.00417.01
8.0.00.0090.00916.75
7.4.330.0000.00516.77
7.4.320.0000.00716.66
7.4.300.0030.00316.55
7.4.290.0030.00316.55
7.4.280.0050.00516.54
7.4.270.0000.00816.47
7.4.260.0050.00216.61
7.4.250.0000.00716.61
7.4.240.0020.00516.61
7.4.230.0070.00016.45
7.4.220.0160.00316.52
7.4.210.0110.00616.62
7.4.200.0070.00016.66
7.4.160.0060.00916.52
7.4.150.0110.00917.40
7.4.140.0140.00817.86
7.4.130.0070.01416.63
7.4.120.0090.00816.56
7.4.110.0070.01416.73
7.4.100.0160.00616.54
7.4.90.0070.01116.46
7.4.80.0120.00619.39
7.4.70.0150.00716.56
7.4.60.0030.01316.61
7.4.50.0070.01016.46
7.4.40.0070.01016.63
7.4.30.0120.00616.79
7.4.10.0170.00316.49
7.4.00.0030.01515.77
7.3.330.0020.00313.45
7.3.320.0060.00013.46
7.3.310.0040.00216.27
7.3.300.0000.00716.50
7.3.290.0040.00416.37
7.3.280.0030.01416.44
7.3.270.0130.00617.40
7.3.260.0130.00316.79
7.3.250.0120.00616.40
7.3.240.0080.01316.59
7.3.230.0060.01316.39
7.3.210.0090.00916.52
7.3.200.0290.01116.31
7.3.190.0090.00916.54
7.3.180.0060.00916.49
7.3.170.0090.01216.61
7.3.160.0170.01116.52
7.3.130.0040.01216.29
7.3.120.0070.01116.61
7.3.110.0060.00916.27
7.3.100.0070.00716.46
7.3.90.0100.00616.43
7.3.80.0070.00716.35
7.3.70.0000.01216.38
7.3.60.0080.00416.43
7.3.50.0090.00616.43
7.3.40.0100.00716.23
7.3.30.0090.00616.38
7.3.20.0060.00618.15
7.3.10.0000.01018.12
7.3.00.0040.01518.27
7.2.330.0030.01716.51
7.2.320.0130.00316.61
7.2.310.0090.00916.66
7.2.300.0030.01616.56
7.2.290.0100.00716.60
7.2.260.0060.01416.45
7.2.250.0110.01116.79
7.2.240.0040.01516.66
7.2.230.0100.00716.38
7.2.220.0030.01416.75
7.2.210.0060.00616.60
7.2.200.0090.00616.77
7.2.190.0030.01216.52
7.2.180.0060.00916.75
7.2.170.0000.01516.70
7.2.160.0030.01016.54
7.2.150.0090.00918.48
7.2.140.0060.00618.30
7.2.130.0070.01018.49
7.2.120.0030.00918.47
7.2.110.0150.00517.47
7.2.100.0030.01018.45
7.2.90.0030.01218.45
7.2.80.0060.00618.39
7.2.70.0090.00618.32
7.2.60.0020.01317.70
7.2.50.0070.00718.36
7.2.40.0000.01418.35
7.2.30.0070.00718.56
7.2.20.0060.00618.62
7.2.10.0070.00718.47
7.2.00.0060.00818.89
7.1.330.0090.00617.35
7.1.320.0070.00417.28
7.1.310.0030.00617.31
7.1.300.0090.00617.24
7.1.290.0110.00417.30
7.1.280.0140.00017.48
7.1.270.0070.00717.54
7.1.260.0110.00417.27
7.1.250.0130.00317.28
7.1.240.0000.01317.32
7.1.230.0000.01017.38
7.1.220.0040.00417.29
7.1.210.0100.00617.33
7.1.200.0060.00516.51
7.1.190.0030.01017.34
7.1.180.0030.01417.23
7.1.170.0040.01117.47
7.1.160.0030.01017.27
7.1.150.0000.01417.44
7.1.140.0090.00617.43
7.1.130.0030.01317.32
7.1.120.0030.01017.39
7.1.110.0060.01217.57
7.1.100.0030.00817.85
7.1.90.0000.01517.47
7.1.80.0100.00717.32
7.1.70.0050.00717.37
7.1.60.0070.01418.04
7.1.50.0070.01217.01
7.1.40.0040.00717.42
7.1.30.0090.00317.47
7.1.20.0060.00617.31
7.1.10.0090.00017.55
7.1.00.0000.04219.80
7.0.330.0060.01117.02
7.0.320.0080.00417.23
7.0.310.0030.01016.96
7.0.300.0030.00916.89
7.0.290.0070.00716.99
7.0.280.0090.00317.14
7.0.270.0030.00917.20
7.0.260.0030.00617.27
7.0.250.0030.00916.98
7.0.240.0030.00717.07
7.0.230.0120.00017.23
7.0.220.0040.00817.12
7.0.210.0030.01017.07
7.0.200.0060.00516.00
7.0.190.0030.00616.99
7.0.180.0090.00617.16
7.0.170.0060.00617.00
7.0.160.0030.00617.07
7.0.150.0070.00417.20
7.0.140.0030.00916.98
7.0.130.0060.00617.12
7.0.120.0000.00816.91
7.0.110.0030.00616.98
7.0.100.0030.00617.02
7.0.90.0000.01617.09
7.0.80.0040.00817.15
7.0.70.0040.01117.04
7.0.60.0060.04019.29
7.0.50.0110.03817.54
7.0.40.0070.02717.60
7.0.30.0190.04317.55
7.0.20.0140.02917.59
7.0.10.0020.04917.69
7.0.00.0070.02317.67
5.6.400.0030.01416.11
5.6.390.0030.00615.77
5.6.380.0090.00616.29
5.6.370.0040.01216.03
5.6.360.0100.00316.05
5.6.350.0030.01015.70
5.6.340.0030.01316.21
5.6.330.0080.00416.19
5.6.320.0070.01116.19
5.6.310.0070.00716.08
5.6.300.0130.00315.93
5.6.290.0000.01016.23
5.6.280.0050.03718.69
5.6.270.0030.01016.13
5.6.260.0030.01015.91
5.6.250.0070.00715.84
5.6.240.0000.01515.93
5.6.230.0040.01415.99
5.6.220.0040.01115.82
5.6.210.0110.03518.47
5.6.200.0030.02717.10
5.6.190.0080.02318.37
5.6.180.0110.02718.39
5.6.170.0170.04318.23
5.6.160.0020.05118.19
5.6.150.0030.04216.97
5.6.140.0080.04216.97
5.6.130.0040.02717.04
5.6.120.0080.02618.56
5.6.110.0100.04018.49
5.6.100.0120.02218.47
5.6.90.0140.03518.60
5.6.80.0090.01918.25
5.6.70.0120.00615.84
5.6.60.0030.01215.98
5.6.50.0080.00815.97
5.6.40.0030.00715.84
5.6.30.0030.01315.89
5.6.20.0100.00715.71
5.6.10.0000.01015.66
5.6.00.0060.00915.95
5.5.380.0000.01215.94
5.5.370.0030.01415.91
5.5.360.0040.01515.77
5.5.350.0030.04718.17
5.5.340.0050.03716.85
5.5.330.0060.04718.25
5.5.320.0250.03018.11
5.5.310.0100.03818.06
5.5.300.0050.04516.83
5.5.290.0070.03017.01
5.5.280.0050.03018.43
5.5.270.0050.03318.53
5.5.260.0080.03718.45
5.5.250.0030.04718.24
5.5.240.0080.04318.12
5.5.230.0000.01715.79
5.5.220.0060.00915.94
5.5.210.0070.00715.97
5.5.200.0030.01015.85
5.5.190.0000.01515.94
5.5.180.0030.01415.81
5.5.170.0040.00815.84
5.5.160.0000.01415.90
5.5.150.0000.01115.79
5.5.140.0090.00315.99
5.5.130.0060.00316.00
5.5.120.0040.00915.93
5.5.110.0030.00915.82
5.5.100.0000.01715.99
5.5.90.0090.00615.93
5.5.80.0090.00315.90
5.5.70.0070.00715.95
5.5.60.0090.00915.88
5.5.50.0070.00715.71
5.5.40.0030.01515.94
5.5.30.0090.00615.79
5.5.20.0100.00715.87
5.5.10.0000.01215.77
5.5.00.0050.00515.81

preferences:
64.5 ms | 401 KiB | 5 Q