3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dec = Decrypt("wpdPVWejqNRYqDTeUJ2Iw06/rnfHAoy5jtgTojiilD0=", "ICS2015", "7"); echo "Dec: " . $dec . "\r\n"; $enc = Encrypt("boy10@naver.com", "ICS2015"); 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 base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, "boy10@naver.com", MCRYPT_MODE_CBC, $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($pass, $salt) { $derived = PBKDF2($pass, $salt, 100, 16); $key = bin2hex(substr($derived, 0, 8)); $iv = bin2hex(substr($derived, 8, 8)); return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $pass, MCRYPT_MODE_CBC, $iv)); } function PBKDF2($pass, $salt, $count, $dklen) { $t = $pass.$salt; $t = sha1($t, true); for($i=2; $i <= $count; $i++) { $t = sha1($t, true); } $t = substr($t,0,$dklen-1); return $t; } 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.0070.00716.98
8.3.50.0170.00221.21
8.3.40.0090.00618.95
8.3.30.0090.00619.02
8.3.20.0050.00320.32
8.3.10.0040.00423.53
8.3.00.0080.00023.46
8.2.180.0120.00918.66
8.2.170.0140.00022.96
8.2.160.0100.00320.52
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0080.00019.83
8.2.120.0040.00426.35
8.2.110.0070.00322.12
8.2.100.0080.00317.93
8.2.90.0030.00619.21
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0000.00818.05
8.2.50.0080.00018.07
8.2.40.0000.00822.09
8.2.30.0070.00020.57
8.2.20.0040.00417.80
8.2.10.0000.00718.24
8.2.00.0000.00818.12
8.1.280.0110.00725.92
8.1.270.0000.00922.27
8.1.260.0100.00028.09
8.1.250.0060.00928.09
8.1.240.0060.00321.03
8.1.230.0040.00819.29
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0030.00717.60
8.1.190.0000.00817.47
8.1.180.0030.00518.10
8.1.170.0060.00318.61
8.1.160.0040.00420.82
8.1.150.0080.00018.95
8.1.140.0040.00419.56
8.1.130.0070.00017.83
8.1.120.0060.00317.56
8.1.110.0050.00317.44
8.1.100.0000.00717.45
8.1.90.0000.00817.58
8.1.80.0030.00717.53
8.1.70.0000.00717.43
8.1.60.0040.00417.56
8.1.50.0080.00017.39
8.1.40.0040.00417.49
8.1.30.0040.00417.81
8.1.20.0080.00017.62
8.1.10.0040.00417.71
8.1.00.0000.00817.42
8.0.300.0070.00018.77
8.0.290.0000.00716.88
8.0.280.0030.00318.42
8.0.270.0000.00717.36
8.0.260.0000.00817.29
8.0.250.0000.00716.98
8.0.240.0040.00417.13
8.0.230.0050.00217.15
8.0.220.0070.00016.91
8.0.210.0030.00616.89
8.0.200.0030.00317.11
8.0.190.0030.00716.96
8.0.180.0040.00417.02
8.0.170.0000.00817.03
8.0.160.0050.00316.91
8.0.150.0070.00016.93
8.0.140.0000.00716.96
8.0.130.0070.00013.49
8.0.120.0030.00616.85
8.0.110.0030.00517.01
8.0.100.0040.00416.84
8.0.90.0040.00416.86
8.0.80.0130.00317.06
8.0.70.0030.00516.88
8.0.60.0040.00417.02
8.0.50.0080.00016.82
8.0.30.0070.01217.20
8.0.20.0110.00917.40
8.0.10.0080.00017.03
8.0.00.0090.01316.78
7.4.330.0000.00516.77
7.4.320.0060.00016.63
7.4.300.0070.00016.63
7.4.290.0040.00416.59
7.4.280.0030.00716.59
7.4.270.0000.00716.58
7.4.260.0030.00416.61
7.4.250.0000.00716.64
7.4.240.0020.00616.62
7.4.230.0030.00316.69
7.4.220.0120.00916.59
7.4.210.0030.01216.59
7.4.200.0040.00416.48
7.4.160.0100.00616.76
7.4.150.0040.01517.40
7.4.140.0110.00817.86
7.4.130.0080.01016.74
7.4.120.0080.01116.79
7.4.110.0070.01116.69
7.4.100.0100.00716.64
7.4.90.0090.01216.57
7.4.80.0110.00919.39
7.4.70.0000.01716.66
7.4.60.0100.00716.74
7.4.50.0070.00716.78
7.4.40.0100.00716.66
7.4.30.0100.01316.75
7.4.00.0060.01015.33
7.3.330.0000.00513.46
7.3.320.0030.00313.50
7.3.310.0000.00716.30
7.3.300.0030.00316.50
7.3.290.0000.00816.45
7.3.280.0130.00516.48
7.3.270.0110.00717.40
7.3.260.0060.01116.64
7.3.250.0130.00616.59
7.3.240.0100.00916.50
7.3.230.0080.01116.44
7.3.210.0100.00616.34
7.3.200.0070.01419.39
7.3.190.0090.01216.63
7.3.180.0090.01216.50
7.3.170.0060.01016.46
7.3.160.0110.01116.66
7.2.330.0100.01316.74
7.2.320.0060.01216.55
7.2.310.0120.00616.88
7.2.300.0110.00816.85
7.2.290.0090.00916.73
7.2.110.0060.00916.73
7.2.100.0070.01016.74
7.2.90.0070.00716.73
7.2.80.0070.00716.51
7.2.70.0100.00717.11
7.2.60.0040.00916.82
7.2.50.0000.01317.00
7.2.40.0100.00317.08
7.2.30.0100.00717.13
7.2.20.0090.00616.96
7.2.10.0070.00316.89
7.2.00.0090.00617.00
7.1.230.0070.00715.86
7.1.220.0100.00315.87
7.1.210.0030.01015.80
7.1.200.0080.00515.82
7.1.190.0030.01015.55
7.1.180.0080.00015.98
7.1.170.0090.00316.00
7.1.160.0030.00615.96
7.1.150.0070.00715.70
7.1.140.0100.00315.82
7.1.130.0070.01015.62
7.1.120.0100.00315.59
7.1.110.0040.00715.95
7.1.100.0060.00717.06
7.1.90.0030.01015.82
7.1.80.0110.00415.81
7.1.70.0070.00416.43
7.1.60.0100.01217.35
7.1.50.0070.00816.33
7.1.40.0090.00616.02
7.1.30.0100.00615.97
7.1.20.0060.00915.93
7.1.10.0030.00715.64
7.1.00.0000.04718.97
7.0.310.0030.00615.33
7.0.300.0060.00915.13
7.0.290.0040.00915.52
7.0.280.0080.00415.49
7.0.270.0040.00815.55
7.0.260.0060.00915.45
7.0.250.0100.00315.48
7.0.240.0000.01015.59
7.0.230.0040.01115.55
7.0.220.0030.00615.50
7.0.210.0040.00815.35
7.0.200.0100.00815.12
7.0.190.0080.00315.28
7.0.180.0070.00515.52
7.0.170.0070.00015.45
7.0.160.0100.00315.43
7.0.150.0040.00715.60
7.0.140.0070.00715.20
7.0.130.0100.00715.59
7.0.120.0040.00415.44
7.0.110.0060.00815.49
7.0.100.0080.00415.42
7.0.90.0040.00715.52
7.0.80.0000.01115.24
7.0.70.0060.00615.07
7.0.60.0000.02618.54
7.0.50.0090.02516.66
7.0.40.0100.02816.86
7.0.30.0200.04016.81
7.0.20.0200.03416.80
7.0.10.0080.02116.80
7.0.00.0050.02516.87
5.6.380.0070.00714.63
5.6.370.0130.00514.71
5.6.360.0150.00614.63
5.6.350.0110.00514.54
5.6.340.0040.01114.38
5.6.330.0110.00714.47
5.6.320.0070.01014.38
5.6.310.0120.00614.43
5.6.300.0000.01414.57
5.6.290.0030.01314.46
5.6.280.0110.00714.04
5.6.270.0150.00314.45
5.6.260.0140.00414.68
5.6.250.0110.00514.46
5.6.240.0130.00314.41
5.6.230.0040.00814.57
5.6.220.0090.00914.34
5.6.210.0080.03017.46
5.6.200.0070.04616.34
5.6.190.0050.02617.38
5.6.180.0190.02117.34
5.6.170.0190.03717.51
5.6.160.0070.04617.49
5.6.150.0100.04016.40
5.6.140.0100.03016.28
5.6.130.0050.03916.38
5.6.120.0100.03517.76
5.6.110.0100.04217.72
5.6.100.0040.02617.75
5.6.90.0050.03617.69
5.6.80.0100.03817.42
5.6.70.0040.00814.09
5.6.60.0060.00614.23
5.6.50.0070.00714.14
5.6.40.0120.00314.39
5.6.30.0000.01414.09
5.6.20.0060.00814.44
5.6.10.0090.00614.18
5.6.00.0070.00314.23
5.5.380.0090.00012.79
5.5.370.0090.00312.79
5.5.360.0000.01112.79
5.5.350.0050.03816.57
5.5.340.0070.04115.41
5.5.330.0080.03816.63
5.5.320.0250.02316.60
5.5.310.0210.03616.49
5.5.300.0090.03515.37
5.5.290.0060.04015.39
5.5.280.0100.03816.80
5.5.270.0070.04216.81
5.5.260.0080.04016.82
5.5.250.0030.04816.67
5.5.240.0120.02816.52
5.5.230.0090.00312.79
5.5.220.0040.00412.79
5.5.210.0030.00712.79
5.5.200.0000.01112.79
5.5.190.0080.00012.79
5.5.180.0000.00912.79
5.5.170.0100.00314.31
5.5.160.0070.00312.79
5.5.150.0040.00812.79
5.5.140.0050.00312.79
5.5.130.0030.00312.79
5.5.120.0000.01012.79
5.5.110.0030.01012.79
5.5.100.0000.00812.79
5.5.90.0060.00312.79
5.5.80.0060.00312.79
5.5.70.0060.00612.79
5.5.60.0060.00312.79
5.5.50.0000.01012.79
5.5.40.0030.01012.79
5.5.30.0040.00412.79
5.5.20.0000.00612.79
5.5.10.0050.00512.79
5.5.00.0030.00712.79

preferences:
56.21 ms | 401 KiB | 5 Q