3v4l.org

run code in 300+ PHP versions simultaneously
<?php $password = "chemicals1"; $expected = "{SSHA512}w/lHn2LXfNletbfyLVYutBFqUjGPzhmptyleVlehUZSZdylZCt/sDmvkhTBV1Ln4f6rzXTdM6eOGr3LX7FgGCF5/fsbs0vVq"; function generate_postfix_ssha512_hash($password, $salt = false) { $hash_algo = "{SSHA512}"; $salt_length = 8; // generate a random salt if one isn't provided $salt = empty($salt) ? random_bytes($salt_length) : $salt; // hash our password with the salt $hash = hash('sha512', "{$password}{$salt}", true); // base64 encode the salt so we have a sane string $hash = base64_encode("{$hash}{$salt}"); // return our generated password hash with identifier return "{$hash_algo}{$hash}"; } function compare_postfix_ssha512_hash($password, $valid_hash) { $hash_algo = "{SSHA512}"; $salt_length = 8; // strip the identifier from the hash (if exists) $valid_hash = str_replace($hash_algo, "", $valid_hash); // get the salt from the valid hash $salt = substr(base64_decode($valid_hash), -$salt_length); // strip the salt from the end of the valid hash $valid_hash = substr(base64_decode($valid_hash), 0, -$salt_length); // hash our password with the salt $hash = generate_postfix_ssha512_hash($password, $salt); // strip the identifier from the hash (if exists) $hash = str_replace($hash_algo, "", $hash); // strip the salt from the end of the valid hash $hash = substr(base64_decode($hash), 0, -$salt_length); // return the comparison return hash_equals($valid_hash, $hash); } var_dump(compare_postfix_ssha512_hash($password, $expected));

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.1.120.0090.00618.66
8.1.110.0130.00518.63
8.1.100.0110.00418.72
8.1.90.0090.00618.72
8.1.80.0120.00318.70
8.1.70.0090.00918.53
8.1.60.0170.00018.86
8.1.50.0060.00618.84
8.1.40.0030.00620.54
8.1.30.0030.00618.89
8.1.20.0030.00618.83
8.1.10.0100.00020.52
8.1.00.0000.00820.44
8.0.250.0070.00018.13
8.0.240.0040.00418.01
8.0.230.0000.00718.02
8.0.220.0120.00017.96
8.0.210.0050.00917.96
8.0.200.0120.00317.99
8.0.190.0090.00617.96
8.0.180.0150.00018.13
8.0.170.0120.00318.05
8.0.160.0050.01017.99
8.0.150.0070.00717.96
8.0.140.0060.00918.08
8.0.130.0120.00318.04
8.0.120.0050.01017.93
8.0.110.0070.00717.95
8.0.100.0120.00318.02
8.0.90.0120.00417.92
8.0.80.0100.00618.13
8.0.70.0150.00018.02
8.0.60.0100.00518.04
8.0.50.0130.00318.02
8.0.30.0150.00018.00
8.0.20.0150.00017.99
8.0.10.0110.00418.00
8.0.00.0080.00818.07
7.4.330.0130.00013.98
7.4.320.0060.00917.50
7.4.300.0130.00317.69
7.4.290.0080.00817.60
7.4.280.0130.00317.79
7.4.270.0120.00417.71
7.4.260.0120.00417.69
7.4.250.0100.01017.56
7.4.240.0000.01617.78
7.4.230.0120.00617.73
7.4.220.0150.00017.63
7.4.210.0140.00017.62
7.4.200.0090.00617.56
7.4.190.0050.01017.63
7.4.180.0040.01117.84
7.4.160.0100.00317.70
7.4.150.0130.00017.68
7.4.140.0110.00417.53
7.4.130.0090.00517.50
7.4.120.0070.00916.95
7.4.110.0090.00916.99
7.4.100.0130.00517.05
7.4.90.0050.01117.01
7.4.80.0090.00517.07
7.4.70.0100.00516.99
7.4.60.0130.00217.06
7.4.50.0110.00517.01
7.4.40.0090.00517.15
7.4.30.0090.00717.12
7.4.20.0050.00917.03
7.4.10.0050.01017.10
7.4.00.0090.00617.09
7.3.330.0140.00017.41
7.3.320.0100.00517.35
7.3.310.0090.00517.48
7.3.300.0040.00917.46
7.3.290.0100.00517.40
7.3.280.0150.00017.49
7.3.270.0070.00717.43
7.3.260.0100.00317.39
7.3.250.0150.00017.27
7.3.240.0110.00516.92
7.3.230.0090.00816.87
7.3.220.0100.00616.87
7.3.210.0110.00516.82
7.3.200.0110.00616.74
7.3.190.0090.00716.79
7.3.180.0060.01016.90
7.3.170.0110.00517.00
7.3.160.0080.00716.78
7.3.150.0110.00416.88
7.3.140.0060.01016.78
7.3.130.0090.00616.86
7.3.120.0030.01216.75
7.3.110.0100.00616.80
7.3.100.0110.00316.65
7.3.90.0050.00917.00
7.3.80.0160.00216.82
7.3.70.0110.00516.95
7.3.60.0050.01016.97
7.3.50.0080.00817.03
7.3.40.0100.00616.91
7.3.30.0100.00616.89
7.3.20.0070.01117.81
7.3.10.0050.01117.80
7.3.00.0090.01017.73
7.2.340.0120.00417.12
7.2.330.0130.00317.10
7.2.320.0100.00517.12
7.2.310.0130.00417.07
7.2.300.0130.00317.08
7.2.290.0060.01317.05
7.2.280.0090.00717.19
7.2.270.0100.00617.01
7.2.260.0140.00517.11
7.2.250.0090.00617.09
7.2.240.0080.00817.10
7.2.230.0110.00517.03
7.2.220.0120.00517.02
7.2.210.0090.00717.00
7.2.200.0100.00717.06
7.2.190.0120.00417.13
7.2.180.0140.00417.10
7.2.170.0090.00817.23
7.2.160.0070.01017.17
7.2.150.0110.00718.04
7.2.140.0130.00318.00
7.2.130.0090.00718.14
7.2.120.0180.00718.10
7.2.110.0110.00818.08
7.2.100.0130.00718.07
7.2.90.0090.01118.20
7.2.80.0100.00918.04
7.2.70.0110.00618.04
7.2.60.0100.00718.13
7.2.50.0150.00218.10
7.2.40.0150.00618.13
7.2.30.0130.00618.16
7.2.20.0110.00618.13
7.2.10.0140.00618.15
7.2.00.0150.00318.13
7.1.330.0180.00617.01
7.1.320.0170.00617.06
7.1.310.0180.00317.03
7.1.300.0130.00817.02
7.1.290.0190.00417.03
7.1.280.0140.00817.00
7.1.270.0160.00516.98
7.1.260.0320.00617.08
7.1.250.0180.00517.02
7.1.240.0110.01217.00
7.1.230.0150.00916.92
7.1.220.0220.00217.00
7.1.210.0250.00217.00
7.1.200.0120.01016.92
7.1.190.0140.00917.02
7.1.180.0160.00916.97
7.1.170.0330.01017.04
7.1.160.0170.01117.03
7.1.150.0210.00417.06
7.1.140.0170.00617.05
7.1.130.0190.00316.95
7.1.120.0170.00716.98
7.1.110.0150.00816.92
7.1.100.0150.00916.88
7.1.90.0180.00416.94
7.1.80.0310.00516.97
7.1.70.0110.00717.18
7.1.60.0150.00317.27
7.1.50.0120.00817.21
7.1.40.0110.00817.21
7.1.30.0160.00417.20
7.1.20.0110.00917.16
7.1.10.0110.00817.17
7.1.00.0120.00717.17
7.0.330.0190.00416.74
7.0.320.0180.00516.63
7.0.310.0140.00716.74
7.0.300.0170.00616.76
7.0.290.0150.00616.64
7.0.280.0140.00816.64
7.0.270.0200.00516.75
7.0.260.0170.00716.64
7.0.250.0120.01016.86
7.0.240.0110.01016.89
7.0.230.0130.00816.75
7.0.220.0130.01016.59
7.0.210.0080.01316.72
7.0.200.0070.01217.09
7.0.190.0090.00917.01
7.0.180.0140.00616.98
7.0.170.0090.00817.10
7.0.160.0120.00517.00
7.0.150.0130.00716.96
7.0.140.0100.00616.97
7.0.130.0130.00516.96
7.0.120.0110.00817.04
7.0.110.0080.01016.99
7.0.100.0130.00816.97
7.0.90.0240.00817.00
7.0.80.0070.01016.98
7.0.70.0050.01116.96
7.0.60.0130.00516.98
7.0.50.0080.01116.98
7.0.40.0040.00916.97
7.0.30.0080.00616.97
7.0.20.0080.00816.95
7.0.10.0090.00417.00
7.0.00.0070.00517.05
5.6.400.0140.00816.52
5.6.390.0150.00716.33
5.6.380.0190.00616.50
5.6.370.0150.00916.35
5.6.360.0150.01016.13
5.6.350.0140.00816.24
5.6.340.0110.01116.52
5.6.330.0180.00616.37
5.6.320.0140.01116.41
5.6.310.0160.00816.36
5.6.300.0070.02417.87
5.6.290.0140.01817.93
5.6.280.0130.01717.87
5.6.270.0130.01817.98
5.6.260.0170.02117.98
5.6.250.0100.02217.96
5.6.240.0130.01817.94
5.6.230.0120.02617.99
5.6.220.0070.01918.09
5.6.210.0090.01718.03
5.6.200.0080.02017.99
5.6.190.0130.01417.98
5.6.180.0060.01918.04
5.6.170.0090.03017.96
5.6.160.0090.02417.93
5.6.150.0030.03118.03
5.6.140.0090.03217.94
5.6.130.0090.02418.00
5.6.120.0110.01618.04
5.6.110.0030.03217.90
5.6.100.0070.02217.94
5.6.90.0090.01717.84
5.6.80.0060.02217.62
5.6.70.0080.02017.68
5.6.60.0070.02217.57
5.6.50.0100.01717.70
5.6.40.0070.02017.72
5.6.30.0090.01917.65
5.6.20.0050.02417.68
5.6.10.0080.01817.74
5.6.00.0090.01617.68

preferences:
37.72 ms | 401 KiB | 5 Q