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"; 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); 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.63
8.3.50.0070.00716.41
8.3.40.0110.00419.05
8.3.30.0070.00718.88
8.3.20.0040.00420.20
8.3.10.0040.00423.53
8.3.00.0040.00423.48
8.2.180.0090.01218.64
8.2.170.0090.00618.93
8.2.160.0090.00622.96
8.2.150.0050.00524.18
8.2.140.0080.00024.66
8.2.130.0000.00819.83
8.2.120.0060.00326.35
8.2.110.0030.00622.14
8.2.100.0040.00817.93
8.2.90.0040.00419.17
8.2.80.0080.00017.97
8.2.70.0000.00917.75
8.2.60.0080.00018.05
8.2.50.0060.00318.07
8.2.40.0000.00922.38
8.2.30.0070.00020.61
8.2.20.0000.00817.86
8.2.10.0040.00418.13
8.2.00.0070.00018.05
8.1.280.0150.00625.92
8.1.270.0000.00822.09
8.1.260.0060.00328.09
8.1.250.0000.00728.09
8.1.240.0090.00023.98
8.1.230.0040.00719.16
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0100.00017.35
8.1.190.0040.00417.11
8.1.180.0000.00818.10
8.1.170.0040.00418.67
8.1.160.0000.00720.75
8.1.150.0050.00318.82
8.1.140.0050.00319.66
8.1.130.0030.00317.79
8.1.120.0050.00317.40
8.1.110.0040.00417.52
8.1.100.0040.00417.44
8.1.90.0000.00717.50
8.1.80.0000.01017.50
8.1.70.0070.00017.38
8.1.60.0000.00817.54
8.1.50.0000.00817.42
8.1.40.0000.00817.56
8.1.30.0050.00317.70
8.1.20.0030.00617.58
8.1.10.0050.00317.59
8.1.00.0030.00617.58
8.0.300.0060.00318.77
8.0.290.0000.00716.88
8.0.280.0070.00018.46
8.0.270.0040.00417.25
8.0.260.0000.00617.29
8.0.250.0030.00317.01
8.0.240.0030.00316.94
8.0.230.0040.00417.09
8.0.220.0070.00016.89
8.0.210.0040.00416.89
8.0.200.0000.00816.93
8.0.190.0000.00817.11
8.0.180.0050.00217.00
8.0.170.0000.00816.96
8.0.160.0040.00417.03
8.0.150.0080.00016.95
8.0.140.0040.00416.99
8.0.130.0030.00313.33
8.0.120.0080.00016.96
8.0.110.0040.00416.82
8.0.100.0020.00516.96
8.0.90.0060.00316.82
8.0.80.0070.00717.03
8.0.70.0000.00716.89
8.0.60.0000.00816.82
8.0.50.0040.00417.05
8.0.30.0140.00317.21
8.0.20.0190.01317.40
8.0.10.0050.00217.20
8.0.00.0090.01316.79
7.4.330.0050.00016.73
7.4.320.0000.00716.63
7.4.300.0000.00616.51
7.4.290.0070.00016.43
7.4.280.0050.00516.47
7.4.270.0000.00816.54
7.4.260.0030.00316.59
7.4.250.0040.00416.52
7.4.240.0020.00616.54
7.4.230.0030.00316.60
7.4.220.0120.01216.43
7.4.210.0080.01016.67
7.4.200.0040.00416.68
7.4.160.0160.00016.62
7.4.150.0110.00617.40
7.4.140.0110.00717.86
7.4.130.0110.00816.57
7.4.120.0090.01016.61
7.4.110.0060.01216.67
7.4.100.0160.00616.55
7.4.90.0110.00716.75
7.4.80.0090.00919.39
7.4.70.0100.00616.55
7.4.60.0070.01016.47
7.4.50.0040.01416.69
7.4.40.0120.00416.55
7.4.30.0090.00816.56
7.4.00.0130.00315.01
7.3.330.0050.00013.28
7.3.320.0000.00513.24
7.3.310.0040.00416.56
7.3.300.0070.00016.46
7.3.290.0000.00716.34
7.3.280.0080.00816.48
7.3.270.0150.00317.40
7.3.260.0110.00616.45
7.3.250.0100.00916.47
7.3.240.0120.00516.53
7.3.230.0090.00916.40
7.3.210.0170.00016.45
7.3.200.0420.01319.39
7.3.190.0060.00916.58
7.3.180.0100.00616.43
7.3.170.0160.00616.46
7.3.160.0020.00216.42
7.2.330.0140.00316.78
7.2.320.0030.01516.55
7.2.310.0060.01116.88
7.2.300.0160.00316.58
7.2.290.0170.00716.78
7.2.110.0350.00416.38
7.2.60.0030.01016.76
7.2.00.0000.01219.26
7.1.200.0030.00616.00
7.1.100.0030.01317.88
7.1.70.0060.00317.21
7.1.60.0070.01719.06
7.1.50.0070.01317.03
7.1.00.0030.07722.40
7.0.200.0120.00614.99
7.0.100.0030.04320.08
7.0.90.0100.03719.94
7.0.80.0100.08320.08
7.0.70.0130.03319.95
7.0.60.0100.03720.03
7.0.50.0070.04720.41
7.0.40.0030.04020.16
7.0.30.0000.05019.97
7.0.20.0200.06720.13
7.0.10.0100.07320.06
7.0.00.0130.08020.20
5.6.280.0030.03721.08
5.6.250.0030.04720.66
5.6.240.0130.04020.78
5.6.230.0100.03320.53
5.6.220.0100.03320.55
5.6.210.0070.03720.61
5.6.200.0070.04021.21
5.6.190.0100.07721.15
5.6.180.0030.05721.07
5.6.170.0070.04021.15
5.6.160.0100.07321.15
5.6.150.0170.04021.14
5.6.140.0130.08321.17
5.6.130.0070.05321.15
5.6.120.0070.07021.15
5.6.110.0030.08321.03
5.6.100.0070.08021.09
5.6.90.0100.08021.11
5.6.80.0100.07320.48
5.6.70.0030.06020.46
5.6.60.0130.07720.41
5.6.50.0030.08020.49
5.6.40.0230.06320.42
5.6.30.0130.08020.43
5.6.20.0030.05020.55
5.6.10.0070.08320.43
5.6.00.0070.07320.42
5.5.380.0030.06720.41
5.5.370.0070.07020.45
5.5.360.0030.04020.37
5.5.350.0030.04020.36
5.5.340.0000.04320.95
5.5.330.0030.04321.04
5.5.320.0000.04720.81
5.5.310.0170.06720.99
5.5.300.0130.07320.86
5.5.290.0030.06720.90
5.5.280.0030.06020.93
5.5.270.0100.04020.89
5.5.260.0170.07320.84
5.5.250.0130.08020.83
5.5.240.0070.06020.24
5.5.230.0070.08020.27
5.5.220.0100.07720.32
5.5.210.0000.08320.32
5.5.200.0130.07320.20
5.5.190.0070.08020.30
5.5.180.0000.06020.20
5.5.160.0030.08320.25
5.5.150.0100.07020.26
5.5.140.0030.07320.35
5.5.130.0070.08020.20
5.5.120.0100.06020.03
5.5.110.0100.08020.23
5.5.100.0170.06720.14
5.5.90.0170.03720.15
5.5.80.0130.07020.21
5.5.70.0130.06320.21
5.5.60.0070.08020.26
5.5.50.0030.07319.99
5.5.40.0030.04720.15
5.5.30.0070.04320.08
5.5.20.0170.07020.16
5.5.10.0130.08020.11
5.5.00.0130.07320.01

preferences:
39.24 ms | 401 KiB | 5 Q