What values should I use for generating Argon2i hashes and how can I find the appropriate settings my hardware can afford?
Namely:
memory_cost
time_cost
threads
as:
$options = [
'memory_cost' => 1<<17,
'time_cost' => 4,
'threads' => 3,
];
$hash = password_hash('test', PASSWORD_ARGON2I, $options);
There is a simple script in PHP docs for finding the appropriate cost value for bcrypt hashes. How can this be fitted for Argon2?
From: PHP RFC Argon2
password_hash
Cost Factors
From:
Threads
From: What Is The Recommended Number Of Iterations For Argon2
From The Argon 2 spec.
(link here)
Further Literature
From Here
Conclusion:
So from the above extracts it seems that you want to aim for a timespan of
0.5ms
as measured by PHPmicrotime
just like in the BCrypt example. Then you can set the number of threads as being twice the number of cores your CPU is running, so say 8 for a 4core processor.You should then be able to run a series of tests with these above two values to find a valid third value for memory_cost.
Run some tests on your server to see what the server can comfortably manage. Explore if this CLI can help.
Change the three variables in the order set out in the quote above (under Threads), so adjust memory over using large iteration counts.
In short we can't give you a "best advice" guide because it depends on what spec. you're intending to run this on...