3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); /** * Verify a Django password (PBKDF2-SHA256) * * @param string $password The password provided by the user * @param string $djangoHash The hash stored in the Django app * @return bool * @throws Exception */ function django_password_verify(string $password, string $djangoHash): bool { $pieces = explode('$', $djangoHash); if (count($pieces) !== 4) { throw new Exception("Illegal hash format"); } list($header, $iter, $salt, $hash) = $pieces; // Get the hash algorithm used: if (preg_match('#^pbkdf2_([a-z0-9A-Z]+)$#', $header, $m)) { $algo = $m[1]; } else { throw new Exception(sprintf("Bad header (%s)", $header)); } if (!in_array($algo, hash_algos())) { throw new Exception(sprintf("Illegal hash algorithm (%s)", $algo)); } $calc = hash_pbkdf2($algo, $password, base64_decode($salt), (int) $iterations); var_dump($calc); return false; } var_dump(django_password_verify('123', 'pbkdf2_sha256$20000$MflWfLXbejfO$tNrjk42YE9ZXkg7IvXY5fikbC+H52Ipd2mf7m0azttk='));

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.5.10.0110.00620.26
8.5.00.0130.01120.50
8.4.150.0020.00014.05
8.4.140.0130.00817.87
8.4.130.0140.00717.90
8.4.120.0110.01020.36
8.4.110.0110.00922.66
8.4.100.0080.01018.23
8.4.90.0120.00718.63
8.4.80.0110.01019.90
8.4.70.0120.00918.41
8.4.60.0110.01118.59
8.4.50.0110.01018.30
8.4.40.0130.00721.59
8.4.30.0070.01318.25
8.4.20.0120.00917.97
8.4.10.0070.00719.72
8.3.280.0090.01018.68
8.3.270.0110.01016.66
8.3.260.0060.00316.80
8.3.250.0120.00619.04
8.3.240.0130.00716.86
8.3.230.0140.00516.91
8.3.220.0100.00817.13
8.3.210.0100.00716.87
8.3.200.0060.00316.69
8.3.190.0070.01220.86
8.3.180.0110.00818.34
8.3.170.0150.00317.04
8.3.160.0080.00018.34
8.3.150.0160.00318.80
8.3.140.0030.00518.54
8.3.130.0000.00918.64
8.3.120.0000.00918.74
8.3.110.0040.00418.53
8.3.100.0130.00318.68
8.3.90.0120.00318.52
8.3.80.0030.00618.56
8.3.70.0110.00718.68
8.3.60.0150.00316.87
8.3.50.0090.01122.09
8.3.40.0070.00719.09
8.3.30.0070.00719.00
8.3.20.0080.00020.29
8.3.10.0000.00721.89
8.3.00.0070.00722.52
8.2.290.0090.01020.48
8.2.280.0070.00118.50
8.2.270.0090.00920.70
8.2.260.0060.00919.04
8.2.250.0100.01018.65
8.2.240.0090.00016.71
8.2.230.0040.00420.94
8.2.220.0030.00624.06
8.2.210.0050.00326.77
8.2.200.0130.00318.51
8.2.190.0150.00616.81
8.2.180.0150.00318.53
8.2.170.0170.00322.96
8.2.160.0070.00719.45
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00822.11
8.2.120.0040.00426.35
8.2.110.0030.00619.33
8.2.100.0090.00317.89
8.2.90.0000.00819.22
8.2.80.0030.00617.97
8.2.70.0050.00318.00
8.2.60.0000.00818.05
8.2.50.0060.00318.10
8.2.40.0040.00422.27
8.2.30.0030.00619.49
8.2.20.0040.00417.89
8.2.10.0000.00718.19
8.2.00.0030.00617.98
8.1.330.0090.00922.04
8.1.320.0100.00816.32
8.1.310.0060.00916.98
8.1.300.0110.00718.39
8.1.290.0040.00718.88
8.1.280.0180.00025.92
8.1.270.0080.00023.82
8.1.260.0070.00028.09
8.1.250.0070.00028.09
8.1.240.0000.00921.13
8.1.230.0040.00717.64
8.1.220.0050.00317.74
8.1.210.0080.00018.77
8.1.200.0000.01017.60
8.1.190.0080.00017.60
8.1.180.0080.00018.10
8.1.170.0000.00918.96
8.1.160.0040.00422.20
8.1.150.0000.00718.82
8.1.140.0050.00319.68
8.1.130.0000.00817.70
8.1.120.0050.00217.66
8.1.110.0040.00417.67
8.1.100.0060.00317.59
8.1.90.0060.00317.63
8.1.80.0000.00717.64
8.1.70.0040.00417.55
8.1.60.0000.00817.80
8.1.50.0000.00817.76
8.1.40.0060.00317.73
8.1.30.0030.00517.74
8.1.20.0000.00817.91
8.1.10.0030.00617.73
8.1.00.0000.00817.57
8.0.300.0040.00418.77
8.0.290.0070.00416.73
8.0.280.0000.00718.50
8.0.270.0000.00717.29
8.0.260.0030.00317.07
8.0.250.0030.00317.24
8.0.240.0000.00717.16
8.0.230.0040.00417.24
8.0.220.0030.00317.14
8.0.210.0030.00317.09
8.0.200.0070.00017.05
8.0.190.0000.00717.10
8.0.180.0000.00717.15
8.0.170.0000.00817.16
8.0.160.0000.00817.08
8.0.150.0070.00017.01
8.0.140.0050.00217.12
8.0.130.0050.00013.56
8.0.120.0040.00417.10
8.0.110.0020.00517.03
8.0.100.0040.00417.15
8.0.90.0000.00817.10
8.0.80.0130.01017.10
8.0.70.0060.00317.10
8.0.60.0000.00717.20
8.0.50.0040.00417.13
8.0.30.0090.01017.27
8.0.20.0130.00717.42
8.0.10.0040.00417.29
8.0.00.0110.00617.13
7.4.330.0050.00015.08
7.4.320.0030.00316.84
7.4.300.0000.00716.74
7.4.290.0000.00716.74
7.4.280.0030.00316.86
7.4.270.0000.00716.74
7.4.260.0030.00316.75
7.4.250.0000.00716.63
7.4.240.0000.00716.78
7.4.230.0030.00616.65
7.4.220.0090.00616.86
7.4.210.0070.01116.88
7.4.200.0030.00616.91
7.4.160.0090.00616.74
7.4.150.0110.01417.40
7.4.140.0100.00817.86
7.4.130.0090.00916.86
7.4.120.0120.00616.70
7.4.110.0140.00316.77
7.4.100.0100.01016.87
7.4.90.0090.00916.86
7.4.80.0060.01219.39
7.4.70.0100.00716.73
7.4.60.0030.01416.88
7.4.50.0000.01216.82
7.4.40.0080.01016.59
7.4.30.0110.00716.78
7.4.00.0040.01115.23
7.3.330.0080.00013.59
7.3.320.0030.00313.58
7.3.310.0040.00416.46
7.3.300.0000.00716.53
7.3.290.0040.00416.42
7.3.280.0080.01116.61
7.3.270.0100.00717.40
7.3.260.0080.01016.71
7.3.250.0140.00416.71
7.3.240.0070.01316.67
7.3.230.0160.00016.84
7.3.210.0100.00616.68
7.3.200.0140.00716.54
7.3.190.0090.00916.75
7.3.180.0090.00916.60
7.3.170.0030.01516.63
7.3.160.0090.00916.69
7.2.330.0100.01016.96
7.2.320.0100.00716.81
7.2.310.0110.00616.81
7.2.300.0150.00617.02
7.2.290.0030.01416.81
7.2.110.0070.00716.63
7.2.100.0060.00616.94
7.2.90.0070.01016.94
7.2.80.0060.00616.93
7.2.70.0070.00417.26
7.2.60.0050.00917.00
7.2.50.0060.00817.08
7.2.40.0040.00717.25
7.2.30.0060.00916.82
7.2.20.0100.00717.32
7.2.10.0030.00616.98
7.2.00.0080.00818.31
7.1.230.0070.00715.88
7.1.220.0040.00715.82
7.1.210.0030.00716.08
7.1.200.0050.00815.93
7.1.190.0050.00515.77
7.1.180.0000.01316.05
7.1.170.0040.00815.73
7.1.160.0040.01116.09
7.1.150.0110.00315.96
7.1.140.0030.00915.77
7.1.130.0000.01415.87
7.1.120.0060.00615.98
7.1.110.0070.00715.91
7.1.100.0140.00816.13
7.1.90.0070.00715.98
7.1.80.0040.00415.95
7.1.70.0060.00716.53
7.1.60.0090.00816.69
7.1.50.0180.00825.46
7.1.40.0060.00915.93
7.1.30.0100.00615.91
7.1.20.0060.00916.18
7.1.10.0070.00316.06
7.1.00.0020.04219.07
7.0.310.0030.00915.39
7.0.300.0030.00915.35
7.0.290.0100.00315.80
7.0.280.0040.00815.46
7.0.270.0040.00715.39
7.0.260.0040.01215.54
7.0.250.0080.00315.29
7.0.240.0090.00315.61
7.0.230.0070.00715.69
7.0.220.0100.00315.70
7.0.210.0080.00415.39
7.0.200.0120.00315.48
7.0.190.0030.00715.65
7.0.180.0000.00915.36
7.0.170.0000.00915.53
7.0.160.0040.00415.64
7.0.150.0080.00415.66
7.0.140.0040.00715.49
7.0.130.0060.00615.62
7.0.120.0000.00715.72
7.0.110.0030.00515.63
7.0.100.0120.02717.81
7.0.90.0030.03617.69
7.0.80.0060.03117.69
7.0.70.0110.02717.83
7.0.60.0080.03217.76
7.0.50.0120.03417.90
7.0.40.0050.03817.00
7.0.30.0090.03217.08
7.0.20.0150.02617.07
7.0.10.0150.02216.97
7.0.00.0120.03017.01
5.6.380.0000.01214.05
5.6.370.0000.01414.05
5.6.360.0000.01513.84
5.6.350.0030.00614.31
5.6.340.0040.00814.40
5.6.330.0080.00414.11
5.6.320.0030.01014.31
5.6.310.0000.01114.34
5.6.300.0050.00514.29
5.6.290.0000.01014.09
5.6.280.0030.00914.07
5.6.270.0100.00314.13
5.6.260.0030.00814.25
5.6.250.0070.03017.51
5.6.240.0090.03117.28
5.6.230.0100.03317.44
5.6.220.0050.03317.46
5.6.210.0110.02817.26
5.6.200.0100.02817.48
5.6.190.0070.04017.58
5.6.180.0030.03417.67
5.6.170.0070.03317.49
5.6.160.0100.02717.52
5.6.150.0100.03017.79
5.6.140.0100.02917.51
5.6.130.0070.03317.46
5.6.120.0100.03217.53
5.6.110.0100.03017.56
5.6.100.0070.03417.52
5.6.90.0030.03717.56
5.6.80.0030.03617.25
5.6.70.0020.03417.28
5.6.60.0070.03117.14
5.6.50.0100.04017.30
5.6.40.0140.02517.42
5.6.30.0050.04317.20
5.6.20.0100.04717.31
5.6.10.0100.04117.28
5.6.00.0080.03017.25

preferences:
41.71 ms | 403 KiB | 5 Q