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.5.30.0120.03218.18
8.5.20.0230.03417.92
8.5.10.0220.03317.93
8.5.00.0230.03118.02
8.4.180.0220.03020.08
8.4.170.0180.03521.32
8.4.160.0240.03121.73
8.4.150.0160.02017.94
8.4.140.0210.02617.97
8.4.130.0200.03218.02
8.4.120.0200.02318.86
8.4.110.0180.02118.95
8.4.100.0260.02918.16
8.4.90.0260.03118.94
8.4.80.0260.02718.05
8.4.70.0280.03018.10
8.4.60.0280.02618.27
8.4.50.0220.02718.54
8.4.40.0230.02019.07
8.4.30.0270.02718.00
8.4.20.0230.02417.98
8.4.10.0200.01918.39
8.3.300.0220.07218.61
8.3.290.0220.08519.89
8.3.280.0170.05918.49
8.3.270.0230.07416.85
8.3.260.0150.06616.86
8.3.250.0210.07017.52
8.3.240.0160.07116.91
8.3.230.0140.05516.83
8.3.220.0150.06317.65
8.3.210.0190.06516.76
8.3.200.0140.06216.85
8.3.190.0120.06017.02
8.3.180.0180.06616.91
8.3.170.0120.06116.82
8.3.160.0170.06016.92
8.3.150.0220.07617.59
8.3.140.0140.06417.04
8.3.130.0120.05417.38
8.3.120.0110.05518.20
8.3.110.0140.05518.10
8.3.100.0210.06916.89
8.3.90.0120.05420.12
8.3.80.0130.05717.78
8.3.70.0170.07116.99
8.3.60.0170.07216.89
8.3.50.0160.07719.55
8.3.40.0160.08018.78
8.3.30.0140.08118.58
8.3.20.0080.06719.60
8.3.10.0120.06620.43
8.3.00.0110.07119.55
8.2.300.0150.06218.84
8.2.290.0120.05718.05
8.2.280.0090.05617.41
8.2.270.0170.07217.72
8.2.260.0110.05316.89
8.2.250.0100.05417.52
8.2.240.0120.05416.96
8.2.230.0100.05818.69
8.2.220.0110.05419.13
8.2.210.0110.05320.04
8.2.200.0130.05817.37
8.2.190.0180.07816.67
8.2.180.0120.07017.29
8.2.170.0160.09018.73
8.2.160.0190.07920.00
8.2.150.0120.06919.90
8.2.140.0120.07020.44
8.2.130.0100.06220.71
8.2.120.0120.06919.17
8.2.110.0120.07218.66
8.2.100.0110.06818.32
8.2.90.0190.06218.33
8.2.80.0170.07318.23
8.2.70.0150.07318.03
8.2.60.0160.06418.12
8.2.50.0170.06418.26
8.2.40.0150.06418.92
8.2.30.0170.07218.35
8.2.20.0140.07218.03
8.2.10.0140.06518.09
8.2.00.0140.06518.00
8.1.340.0160.06017.69
8.1.330.0180.07718.36
8.1.320.0110.05916.33
8.1.310.0120.06417.14
8.1.300.0130.05717.54
8.1.290.0130.05521.23
8.1.280.0130.07519.60
8.1.270.0110.07020.73
8.1.260.0100.06420.91
8.1.250.0140.06221.52
8.1.240.0120.07118.51
8.1.230.0120.06618.93
8.1.220.0120.08017.89
8.1.210.0160.06518.05
8.1.200.0160.06417.75
8.1.190.0120.06517.79
8.1.180.0110.07117.78
8.1.170.0140.06718.00
8.1.160.0140.06318.67
8.1.150.0110.07118.42
8.1.140.0120.06818.21
8.1.130.0160.06717.85
8.1.120.0130.06517.92
8.1.110.0120.06617.82
8.1.100.0110.06518.02
8.1.90.0080.06717.79
8.1.80.0120.06617.97
8.1.70.0120.06917.95
8.1.60.0160.07317.96
8.1.50.0160.07218.10
8.1.40.0130.06817.90
8.1.30.0120.06818.00
8.1.20.0130.07118.12
8.1.10.0150.06918.29
8.1.00.0140.06717.97
8.0.300.0130.06817.44
8.0.290.0130.07417.19
8.0.280.0160.06617.45
8.0.270.0150.06617.23
8.0.260.0150.06417.61
8.0.250.0140.07017.66
8.0.240.0130.06617.45
8.0.230.0130.06617.45
8.0.220.0150.06517.61
8.0.210.0130.06717.55
8.0.200.0120.06417.64
8.0.190.0120.06317.63
8.0.180.0120.06617.76
8.0.170.0110.06517.41
8.0.160.0150.06417.56
8.0.150.0150.06717.51
8.0.140.0140.06617.49
8.0.130.0100.06916.98
8.0.120.0130.06717.32
8.0.110.0140.06617.56
8.0.100.0130.06717.51
8.0.90.0140.06817.49
8.0.80.0120.07717.93
8.0.70.0100.06717.53
8.0.60.0120.07117.48
8.0.50.0130.07417.44
8.0.30.0130.07617.47
8.0.20.0140.08617.51
8.0.10.0160.08817.61
8.0.00.0140.09617.55
7.4.330.0120.06816.61
7.4.320.0170.06716.96
7.4.300.0150.06216.90
7.4.290.0130.06816.91
7.4.280.0160.06516.92
7.4.270.0140.06616.89
7.4.260.0150.06216.98
7.4.250.0160.06416.94
7.4.240.0130.07216.87
7.4.230.0160.07016.91
7.4.220.0150.08216.97
7.4.210.0170.08516.90
7.4.200.0160.06316.88
7.4.190.0180.06716.97
7.4.180.0140.06416.96
7.4.160.0160.06717.06
7.4.150.0130.08116.99
7.4.140.0140.09117.10
7.4.130.0150.08916.92
7.4.120.0140.08416.88
7.4.110.0130.08716.97
7.4.100.0160.09216.90
7.4.90.0130.09616.89
7.4.80.0180.09417.04
7.4.70.0140.09516.98
7.4.60.0140.09617.01
7.4.50.0140.09116.94
7.4.40.0140.09416.94
7.4.30.0130.09117.04
7.4.20.0140.09417.00
7.4.10.0150.09716.99
7.4.00.0110.10116.72
7.3.330.0160.06616.45
7.3.320.0160.06616.47
7.3.310.0140.06716.76
7.3.300.0150.06816.72
7.3.290.0150.06416.86
7.3.280.0130.09416.70
7.3.270.0140.07716.79
7.3.260.0150.09316.81
7.3.250.0170.08916.75
7.3.240.0160.09016.78
7.3.230.0150.09116.76
7.3.220.0160.09316.77
7.3.210.0160.09116.74
7.3.200.0140.09816.89
7.3.190.0140.09316.86
7.3.180.0150.09516.85
7.3.170.0150.09516.87
7.3.160.0140.09816.89
7.3.150.0140.09816.91
7.3.140.0150.10316.83
7.3.130.0160.10416.88
7.3.120.0140.10316.70
7.3.110.0140.09716.69
7.3.100.0140.09916.50
7.3.90.0170.09716.60
7.3.80.0160.10216.49
7.3.70.0130.10416.44
7.3.60.0130.09916.45
7.3.50.0130.10316.44
7.3.40.0130.10216.44
7.3.30.0150.09516.28
7.3.20.0170.09616.96
7.3.10.0160.09916.92
7.3.00.0190.09917.04
7.2.340.0160.09316.93
7.2.330.0190.09517.05
7.2.320.0170.10217.04
7.2.310.0150.09417.02
7.2.300.0150.09517.07
7.2.290.0170.09817.01
7.2.280.0170.09517.06
7.2.270.0180.09017.04
7.2.260.0170.09917.05
7.2.250.0150.09716.82
7.2.240.0160.10316.89
7.2.230.0150.10116.74
7.2.220.0160.10416.75
7.2.210.0170.10216.63
7.2.200.0130.09616.62
7.2.190.0160.10016.57
7.2.180.0160.10516.59
7.2.170.0170.10616.61
7.2.160.0140.10116.54
7.2.150.0200.09517.25
7.2.140.0220.10117.18
7.2.130.0200.09917.35
7.2.120.0300.10317.18
7.2.110.0190.10217.22
7.2.100.0210.10017.23
7.2.90.0170.09917.22
7.2.80.0220.10317.25
7.2.70.0200.10117.19
7.2.60.0200.10017.17
7.2.50.0220.09617.18
7.2.40.0220.09617.24
7.2.30.0210.09817.24
7.2.20.0190.09617.23
7.2.10.0220.10017.23
7.2.00.0200.09917.23
7.1.330.0200.09316.70
7.1.320.0180.10016.43
7.1.310.0180.10216.33
7.1.300.0190.09916.26
7.1.290.0170.09916.23
7.1.280.0190.10016.26
7.1.270.0180.10116.13
7.1.260.0210.09716.12
7.1.250.0210.09516.24
7.1.240.0200.09916.12
7.1.230.0240.09516.15
7.1.220.0220.09816.13
7.1.210.0220.09716.19
7.1.200.0240.10116.13
7.1.190.0220.10116.17
7.1.180.0220.09916.13
7.1.170.0280.10116.10
7.1.160.0200.09916.16
7.1.150.0200.09616.17
7.1.140.0210.10416.16
7.1.130.0280.10316.22
7.1.120.0210.09516.23
7.1.110.0230.10116.34
7.1.100.0250.09616.28
7.1.90.0250.10716.25
7.1.80.0230.10316.30
7.1.70.0280.10516.25
7.1.60.0290.10316.98
7.1.50.0310.10117.01
7.1.40.0270.10216.96
7.1.30.0320.10016.97
7.1.20.0300.10016.95
7.1.10.0280.09816.33
7.1.00.0220.10116.29
7.0.330.0190.10416.02
7.0.320.0220.10115.91
7.0.310.0200.10115.95
7.0.300.0240.10115.98
7.0.290.0260.09915.93
7.0.280.0220.10015.95
7.0.270.0220.10115.91
7.0.260.0210.10015.94
7.0.250.0230.09816.04
7.0.240.0220.10016.01
7.0.230.0230.10616.02
7.0.220.0240.10115.96
7.0.210.0260.09916.00
7.0.200.0280.10815.97
7.0.190.0280.10216.03
7.0.180.0280.10615.98
7.0.170.0280.09715.99
7.0.160.0280.09815.93
7.0.150.0340.09515.96
7.0.140.0290.10115.92
7.0.130.0240.09816.03
7.0.120.0310.10416.05
7.0.110.0210.10016.03
7.0.100.0220.09915.95
7.0.90.0410.10015.91
7.0.80.0190.10015.95
7.0.70.0310.09915.92
7.0.60.0300.11015.91
7.0.50.0190.09915.97
7.0.40.0230.10316.02
7.0.30.0210.10116.02
7.0.20.0240.10315.95
7.0.10.0210.10516.00
7.0.00.0230.10215.97
5.6.400.0160.00915.56
5.6.390.0150.00815.53
5.6.380.0140.01015.53
5.6.370.0160.00815.55
5.6.360.0140.00815.57
5.6.350.0160.00715.55
5.6.340.0160.00915.60
5.6.330.0160.00915.57
5.6.320.0160.00915.59
5.6.310.0170.00815.59
5.6.300.0180.01315.89
5.6.290.0170.01215.98
5.6.280.0160.01115.99
5.6.270.0160.01215.99
5.6.260.0160.01215.95
5.6.250.0170.01115.97
5.6.240.0150.01415.97
5.6.230.0170.01215.99
5.6.220.0180.01215.97
5.6.210.0170.01215.95
5.6.200.0170.01216.00
5.6.190.0180.01215.97
5.6.180.0170.01215.97
5.6.170.0170.01215.95
5.6.160.0170.01315.96
5.6.150.0170.01215.99
5.6.140.0180.01215.98
5.6.130.0180.01215.99
5.6.120.0160.01315.95
5.6.110.0160.01315.94
5.6.100.0170.01315.94
5.6.90.0180.01115.93
5.6.80.0170.01115.87
5.6.70.0150.01315.88
5.6.60.0170.01215.89
5.6.50.0150.01215.92
5.6.40.0170.01015.85
5.6.30.0160.01215.83
5.6.20.0160.01215.84
5.6.10.0160.01215.86
5.6.00.0160.01115.83

preferences:
29.02 ms | 403 KiB | 5 Q