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 = PBKDF1($pass, $salt, 100, 16); $key = bin2hex(substr($derived, 0, 8)); $iv = bin2hex(substr($derived, 8, 8)); return 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.75
8.3.50.0090.00921.20
8.3.40.0090.01218.96
8.3.30.0130.00318.84
8.3.20.0040.00420.13
8.3.10.0070.00023.56
8.3.00.0080.00023.56
8.2.180.0170.00318.29
8.2.170.0110.00422.96
8.2.160.0140.00020.35
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0000.00919.82
8.2.120.0070.00026.35
8.2.110.0090.00022.25
8.2.100.0120.00018.04
8.2.90.0040.00419.21
8.2.80.0050.00318.05
8.2.70.0000.00917.63
8.2.60.0090.00017.80
8.2.50.0050.00518.07
8.2.40.0030.00622.17
8.2.30.0000.00720.68
8.2.20.0040.00417.84
8.2.10.0000.00818.09
8.2.00.0050.00318.02
8.1.280.0070.01125.92
8.1.270.0060.00322.22
8.1.260.0030.00628.09
8.1.250.0150.00028.09
8.1.240.0090.00023.92
8.1.230.0110.00019.04
8.1.220.0080.00017.76
8.1.210.0000.00818.77
8.1.200.0060.00317.48
8.1.190.0040.00417.25
8.1.180.0050.00318.10
8.1.170.0000.00818.65
8.1.160.0050.00320.86
8.1.150.0050.00318.93
8.1.140.0070.00419.67
8.1.130.0040.00417.49
8.1.120.0090.00017.48
8.1.110.0040.00417.49
8.1.100.0000.00717.33
8.1.90.0040.00417.54
8.1.80.0030.00717.39
8.1.70.0040.00417.48
8.1.60.0090.00017.64
8.1.50.0000.00817.45
8.1.40.0040.00417.56
8.1.30.0040.00417.62
8.1.20.0000.00817.73
8.1.10.0080.00017.67
8.1.00.0040.00417.59
8.0.300.0080.00018.77
8.0.290.0040.00416.88
8.0.280.0070.00018.42
8.0.270.0030.00317.32
8.0.260.0040.00416.85
8.0.250.0040.00417.07
8.0.240.0030.00317.05
8.0.230.0070.00017.02
8.0.220.0040.00417.01
8.0.210.0040.00416.97
8.0.200.0000.00717.03
8.0.190.0130.00017.05
8.0.180.0070.00017.04
8.0.170.0050.00316.92
8.0.160.0000.00817.05
8.0.150.0000.00816.98
8.0.140.0040.00416.90
8.0.130.0000.00613.42
8.0.120.0000.00916.98
8.0.110.0000.00717.00
8.0.100.0000.00816.89
8.0.90.0070.00016.97
8.0.80.0100.01017.00
8.0.70.0000.00716.87
8.0.60.0070.00017.02
8.0.50.0040.00417.05
8.0.30.0090.01117.31
8.0.20.0060.01217.40
8.0.10.0000.00717.10
8.0.00.0140.00716.91
7.4.330.0000.00516.80
7.4.320.0030.00316.66
7.4.300.0000.00616.49
7.4.290.0000.00716.66
7.4.280.0030.00716.59
7.4.270.0020.00516.66
7.4.260.0030.00316.64
7.4.250.0030.00516.53
7.4.240.0020.00616.58
7.4.230.0080.00016.70
7.4.220.0090.01016.62
7.4.210.0050.01016.67
7.4.200.0040.00416.65
7.4.160.0160.00016.88
7.4.150.0150.00317.40
7.4.140.0150.00417.86
7.4.130.0090.00916.52
7.4.120.0100.00716.60
7.4.110.0090.00916.61
7.4.100.0040.01416.57
7.4.90.0130.00616.55
7.4.80.0060.01619.39
7.4.70.0160.00316.76
7.4.60.0070.01016.75
7.4.50.0040.01116.50
7.4.40.0030.01316.65
7.4.30.0090.01316.73
7.4.00.0030.01114.97
7.3.330.0030.00313.48
7.3.320.0030.00313.46
7.3.310.0000.00716.46
7.3.300.0030.00316.35
7.3.290.0000.00816.36
7.3.280.0110.00716.46
7.3.270.0060.01117.40
7.3.260.0120.00616.54
7.3.250.0060.01116.44
7.3.240.0130.00516.54
7.3.230.0140.00416.41
7.3.210.0130.00316.68
7.3.200.0130.00319.39
7.3.190.0150.00416.43
7.3.180.0120.00916.58
7.3.170.0130.00316.50
7.3.160.0100.01316.69
7.3.120.0100.01014.97
7.3.110.0070.01014.95
7.3.100.0140.00014.72
7.3.90.0050.00515.12
7.3.80.0050.00514.63
7.3.70.0030.01014.87
7.3.60.0060.00614.97
7.3.50.0080.00814.91
7.3.40.0000.01014.82
7.3.30.0030.01314.91
7.3.20.0030.01016.51
7.3.10.0100.00516.60
7.3.00.0110.00416.67
7.2.330.0110.00616.70
7.2.320.0130.00316.87
7.2.310.0060.01016.91
7.2.300.0110.00716.80
7.2.290.0120.00516.60
7.2.250.0090.01215.21
7.2.240.0100.01015.22
7.2.230.0120.00315.20
7.2.220.0060.00615.07
7.2.210.0050.00514.86
7.2.200.0060.00615.06
7.2.190.0040.00715.16
7.2.180.0130.00015.15
7.2.170.0040.01515.18
7.2.130.0110.00416.70
7.2.120.0110.00416.97
7.2.110.0100.00716.71
7.2.100.0070.00716.67
7.2.90.0030.00917.07
7.2.80.0040.01116.63
7.2.70.0030.01017.01
7.2.60.0050.01016.81
7.2.50.0000.01216.81
7.2.40.0090.00017.10
7.2.30.0070.01017.05
7.2.20.0030.00917.06
7.2.10.0100.00717.01
7.2.00.0030.01018.25
7.1.330.0070.00715.94
7.1.320.0000.01115.71
7.1.310.0030.01015.59
7.1.300.0060.01015.80
7.1.290.0060.00315.76
7.1.280.0090.00915.95
7.1.270.0060.00615.65
7.1.260.0000.01615.90
7.1.250.0060.00615.65
7.1.200.0030.01215.72
7.1.100.0000.01218.34
7.1.70.0070.01017.27
7.1.60.0140.01019.06
7.1.50.0000.01217.11
7.1.00.0030.07722.47
7.0.200.0080.00415.08
7.0.60.0030.08321.68
7.0.50.0070.08018.14
7.0.40.0100.07720.29
7.0.30.0430.05020.11
7.0.20.0370.05720.10
7.0.10.0000.04720.32
7.0.00.0070.04020.23
5.6.280.0070.03021.12
5.6.210.0200.06720.54
5.6.200.0070.08318.20
5.6.190.0030.04320.50
5.6.180.0300.04020.69
5.6.170.0370.05320.55
5.6.160.0030.08720.48
5.6.150.0030.08718.26
5.6.140.0070.05718.29
5.6.130.0230.07018.35
5.6.120.0070.08721.11
5.6.110.0030.06021.16
5.6.100.0130.07321.15
5.6.90.0030.09321.13
5.6.80.0030.08020.46
5.5.350.0070.08320.46
5.5.340.0070.08318.00
5.5.330.0130.07720.26
5.5.320.0600.04020.20
5.5.310.0230.07720.42
5.5.300.0070.06318.02
5.5.290.0130.05018.02
5.5.280.0130.03720.71
5.5.270.0000.09320.89
5.5.260.0100.08020.86
5.5.250.0030.07320.69
5.5.240.0230.07020.13

preferences:
42.65 ms | 401 KiB | 5 Q