Argon2 parameters in dockerized environment

12/3/2019

I am deploying a spring-boot/kotlin based microservice for authentication into a Kubernets cluster. In order to securely store and compare passwords I would like to use Argon2 but I am having trouble finding the right parameters.

  • Since the service is supposed to run in a public cloud, I chose the Argon2id mode to lower the risk of side-channel attacks.
  • Following general OWASP recommendations I chose a salt and output length of 32B.
  • Given constraints in a dockerized environment I picked a parallelism factor of 2.
  • Overall, I would like a hashing operation to take about 1s.

Now the parameter that bugs me is memory. The whitepaper in section 8 suggests using about 1GB of memory. Currently our pods have a memory limit of 1GB all together and I would not like to change that limit without proper reasoning. Using that much memory would also mean that only one user can authenticate at once per service instance. More importantly, though, in order to achieve acceptable times using 1GB I needed to set the iterations to 1. What irritated me in particular is that the default memory cost in all libraries that I found (incl. the reference implementation) lies between 2^12KB=4MB and 2^16KB=64MB.

My question therefore is: are there recommendations or suggestion on how to trade-off memory and iterations, especially in a dockerized environment? I achieved good results using 5 iterations and 2^18KB=262MB. Given that the memory hardness of Argon2 is directed at the use of specialized hardware, is a memory limit of 260MB sufficient?

Edit: To make my problem more clear: all discussions I could find suggest taking as much memory as I can afford and my machine offers. In a cloud environment this role is usually inverted and I need to state how much resources I require.

-- elactic
docker
java
kubernetes
password-hash
passwords

0 Answers