3
$\begingroup$

I know the question of "how many iterations should I use with PBKDF2" is asked quite often, and the answer is typically "test and see what's practical."

However, my key derivation will be taking place on theoretically any client, and does not happen on the server side. So it could be on an iPhone, Android, PC, Mac, Web, etc.

On my Mac, using WebCrypto and Chrome, 1,000,000 iterations takes less than a second. However, I can't test this on other clients not in front of me.

I know the best answer will be "test on every client you plan to support."

However, if we were to establish some baselines for what a "modern computing device" would be, how can we calculate an optimal number of iterations?

Assume here that we define the minimum for what constitutes a modern computing device as: Any smartphone released in or after 2015.

$\endgroup$
6
  • $\begingroup$ What hash function for PBKDF2 are we talking about and why are bcrypt and Argon2 not an option? $\endgroup$
    – SEJPM
    Dec 14, 2016 at 16:43
  • $\begingroup$ @SEJPM hmac-sha512 or 256. I'm just more familiar with pbkdf2 than the others. $\endgroup$
    – Snowman
    Dec 14, 2016 at 16:48
  • 1
    $\begingroup$ Well, if you have the required pennies and are ready measuring and testing, the big cloud providers offer ways to test your apps in the cloud on real devices. This would allow you to just measure what your picked phones can handle and will then allow you to decide which iteration count is right for you. $\endgroup$
    – SEJPM
    Dec 14, 2016 at 16:51
  • $\begingroup$ Can optimum number of iterations be represented as a function of CPU and memory? $\endgroup$
    – Snowman
    Dec 14, 2016 at 17:14
  • 1
    $\begingroup$ Related Q&A “Can I dynamically calculate an appropriate number of iterations for PBKDF2 based on the system time, rather than using a fixed value?” has an answer that practically answers your Q too, while the linked Security.SE answer by Thomas Pornin dives into all the details $\endgroup$
    – e-sushi
    Dec 15, 2016 at 5:14

0

Browse other questions tagged or ask your own question.