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, $salt, (int) $iter, 32, true ); return hash_equals($calc, base64_decode($hash)); } var_dump( django_password_verify( '123', 'pbkdf2_sha256$20000$MflWfLXbejfO$tNrjk42YE9ZXkg7IvXY5fikbC+H52Ipd2mf7m0azttk=' ) ); var_dump( django_password_verify( 'password', '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.3.60.0200.10116.88
8.3.50.0130.10022.27
8.3.40.0150.10619.46
8.3.30.0110.10119.07
8.3.20.0050.07421.15
8.3.10.0100.07922.73
8.3.00.0120.08620.90
8.2.180.0070.09418.79
8.2.170.0160.09019.21
8.2.160.0130.09021.71
8.2.150.0080.06921.73
8.2.140.0110.08422.68
8.2.130.0070.07023.38
8.2.120.0120.07820.25
8.2.110.0110.08719.29
8.2.100.0120.08018.71
8.2.90.0230.06618.45
8.2.80.0180.07518.28
8.2.70.0140.07218.03
8.2.60.0180.06718.17
8.2.50.0170.06818.25
8.2.40.0160.06919.28
8.2.30.0140.07418.56
8.2.20.0140.07218.07
8.2.10.0140.06918.16
8.2.00.0160.06718.00
8.1.280.0130.11025.92
8.1.270.0070.08323.53
8.1.260.0100.07024.17
8.1.250.0100.06825.22
8.1.240.0070.08619.28
8.1.230.0100.07620.07
8.1.220.0100.07717.95
8.1.210.0180.06918.17
8.1.200.0170.06817.75
8.1.190.0120.07017.83
8.1.180.0110.07617.89
8.1.170.0140.07418.12
8.1.160.0140.06819.03
8.1.150.0100.07918.67
8.1.140.0120.07318.46
8.1.130.0150.06617.84
8.1.120.0120.06917.96
8.1.110.0100.07117.85
8.1.100.0080.07018.05
8.1.90.0060.07217.83
8.1.80.0110.07018.00
8.1.70.0110.07217.97
8.1.60.0140.06917.95
8.1.50.0150.06718.16
8.1.40.0130.07017.95
8.1.30.0110.07018.01
8.1.20.0130.07518.15
8.1.10.0140.07318.40
8.1.00.0140.07018.01
8.0.300.0120.07517.66
8.0.290.0130.07817.24
8.0.280.0170.07117.62
8.0.270.0160.07217.30
8.0.260.0170.06717.77
8.0.250.0140.07217.89
8.0.240.0140.07017.57
8.0.230.0120.07117.56
8.0.220.0150.06917.80
8.0.210.0130.07017.69
8.0.200.0120.06817.76
8.0.190.0120.06617.78
8.0.180.0120.06917.90
8.0.170.0130.06717.51
8.0.160.0150.06617.69
8.0.150.0160.07117.61
8.0.140.0140.06817.60
8.0.130.0100.07316.91
8.0.120.0130.07117.39
8.0.110.0150.06817.70
8.0.100.0130.07117.61
8.0.90.0140.07217.64
8.0.80.0120.07918.13
8.0.70.0100.07017.64
8.0.60.0110.07317.62
8.0.50.0130.07117.58
8.0.30.0120.07717.54
8.0.20.0130.08717.59
8.0.10.0170.08317.67
8.0.00.0130.09717.57
7.4.330.0100.06916.44
7.4.320.0180.06916.98
7.4.300.0160.06616.92
7.4.290.0140.07216.88
7.4.280.0180.06816.89
7.4.270.0140.07016.91
7.4.260.0150.06516.95
7.4.250.0160.06716.98
7.4.240.0120.06816.89
7.4.230.0170.06916.94
7.4.220.0160.08916.97
7.4.210.0180.08716.91
7.4.200.0180.06516.91
7.4.190.0200.07017.01
7.4.180.0150.06616.97
7.4.160.0180.07117.06
7.4.150.0140.08716.99
7.4.140.0150.09317.13
7.4.130.0150.09116.93
7.4.120.0140.08916.91
7.4.110.0130.09316.97
7.4.100.0150.09016.90
7.4.90.0130.10116.91
7.4.80.0190.09917.05
7.4.70.0140.09917.01
7.4.60.0140.10117.04
7.4.50.0150.09516.98
7.4.40.0150.09916.97
7.4.30.0140.09317.05
7.4.20.0140.10017.01
7.4.10.0150.10217.01
7.4.00.0110.10616.71
7.3.330.0160.07016.33
7.3.320.0160.06716.44
7.3.310.0140.07116.81
7.3.300.0160.06816.75
7.3.290.0150.06516.93
7.3.280.0140.10216.71
7.3.270.0140.08316.83
7.3.260.0140.09016.85
7.3.250.0190.09316.79
7.3.240.0160.09216.81
7.3.230.0160.09316.79
7.3.220.0160.09916.79
7.3.210.0160.09616.76
7.3.200.0140.10116.92
7.3.190.0140.09516.89
7.3.180.0150.09816.89
7.3.170.0160.09716.92
7.3.160.0140.10116.92
7.3.150.0140.10116.94
7.3.140.0150.10916.87
7.3.130.0170.10816.92
7.3.120.0140.10616.71
7.3.110.0150.10216.71
7.3.100.0140.10316.49
7.3.90.0180.10216.56
7.3.80.0160.10516.47
7.3.70.0130.10916.41
7.3.60.0140.10316.42
7.3.50.0130.10616.40
7.3.40.0140.10616.41
7.3.30.0150.09816.24
7.3.20.0170.10016.82
7.3.10.0160.10316.80
7.3.00.0190.10316.92
7.2.340.0160.10016.96
7.2.330.0190.09816.95
7.2.320.0170.10517.05
7.2.310.0160.09917.06
7.2.300.0150.09817.11
7.2.290.0160.10217.05
7.2.280.0180.10017.10
7.2.270.0180.09417.09
7.2.260.0180.10217.08
7.2.250.0160.10216.82
7.2.240.0160.10616.90
7.2.230.0150.10616.73
7.2.220.0170.10816.72
7.2.210.0170.10716.62
7.2.200.0130.10016.60
7.2.190.0150.10216.56
7.2.180.0170.11016.57
7.2.170.0180.11016.58
7.2.160.0140.10416.51
7.2.150.0200.09517.12
7.2.140.0230.10517.06
7.2.130.0210.10317.22
7.2.120.0310.10717.05
7.2.110.0190.10617.09
7.2.100.0220.10317.11
7.2.90.0170.10317.10
7.2.80.0220.10517.12
7.2.70.0210.10417.04
7.2.60.0210.10417.04
7.2.50.0230.09917.04
7.2.40.0230.10017.10
7.2.30.0220.10217.11
7.2.20.0200.10017.08
7.2.10.0230.10317.10
7.2.00.0210.10317.09
7.1.330.0210.09716.58
7.1.320.0180.10416.31
7.1.310.0180.10716.20
7.1.300.0200.10316.14
7.1.290.0180.10316.11
7.1.280.0180.10216.15
7.1.270.0180.10516.01
7.1.260.0210.10015.99
7.1.250.0210.09916.14
7.1.240.0200.10315.99
7.1.230.0260.09916.03
7.1.220.0230.10216.01
7.1.210.0220.09916.07
7.1.200.0250.10516.00
7.1.190.0220.10316.05
7.1.180.0220.10316.00
7.1.170.0290.10515.99
7.1.160.0210.10316.04
7.1.150.0210.10016.04
7.1.140.0220.10816.04
7.1.130.0300.10716.11
7.1.120.0220.09816.10
7.1.110.0240.10516.21
7.1.100.0260.09716.15
7.1.90.0260.11016.13
7.1.80.0240.10516.18
7.1.70.0290.10716.14
7.1.60.0310.10416.93
7.1.50.0330.10516.95
7.1.40.0290.10516.90
7.1.30.0330.10316.90
7.1.20.0320.10416.89
7.1.10.0290.10016.23
7.1.00.0230.10516.18
7.0.330.0200.10615.90
7.0.320.0220.10315.78
7.0.310.0210.10515.83
7.0.300.0250.10515.84
7.0.290.0270.10215.82
7.0.280.0230.10415.83
7.0.270.0230.10515.81
7.0.260.0220.10415.82
7.0.250.0230.10215.91
7.0.240.0220.10315.89
7.0.230.0240.11115.89
7.0.220.0250.10315.83
7.0.210.0270.10315.87
7.0.200.0290.11115.86
7.0.190.0290.10615.92
7.0.180.0290.11015.87
7.0.170.0290.10115.88
7.0.160.0290.10015.82
7.0.150.0360.09815.84
7.0.140.0300.10415.80
7.0.130.0250.10115.92
7.0.120.0330.10815.96
7.0.110.0210.10115.93
7.0.100.0230.09915.84
7.0.90.0430.10315.80
7.0.80.0200.10415.84
7.0.70.0330.10315.80
7.0.60.0310.11215.81
7.0.50.0190.10215.88
7.0.40.0230.10615.92
7.0.30.0210.10515.92
7.0.20.0250.10615.86
7.0.10.0210.10715.92
7.0.00.0240.10415.88
5.6.400.0160.00915.53
5.6.390.0150.00815.54
5.6.380.0140.01015.51
5.6.370.0160.00915.53
5.6.360.0150.00915.56
5.6.350.0170.00815.53
5.6.340.0160.00915.61
5.6.330.0160.00915.55
5.6.320.0160.01015.58
5.6.310.0170.00915.58
5.6.300.0180.01415.91
5.6.290.0170.01216.00
5.6.280.0160.01216.03
5.6.270.0160.01216.01
5.6.260.0160.01215.96
5.6.250.0170.01215.99
5.6.240.0140.01415.99
5.6.230.0170.01215.99
5.6.220.0170.01315.98
5.6.210.0160.01315.96
5.6.200.0170.01216.01
5.6.190.0170.01215.98
5.6.180.0160.01215.98
5.6.170.0170.01215.96
5.6.160.0160.01315.96
5.6.150.0170.01216.00
5.6.140.0180.01215.99
5.6.130.0170.01216.00
5.6.120.0160.01315.96
5.6.110.0150.01415.95
5.6.100.0160.01315.96
5.6.90.0180.01115.95
5.6.80.0160.01215.87
5.6.70.0140.01315.88
5.6.60.0160.01315.90
5.6.50.0150.01215.93
5.6.40.0170.01015.85
5.6.30.0160.01315.84
5.6.20.0160.01315.85
5.6.10.0160.01215.87
5.6.00.0160.01215.84

preferences:
55.38 ms | 401 KiB | 5 Q