11

I've read some articles saying you should set the cost to be at least 16 (216), yet others say 8 or so is fine.

Is there any official standard for how high the cost should be set to?

2

3 Answers 3

10

The cost you should use depends on how fast your hardware (and implementation) is.

Generally speaking a cost of 8 or 10 is fine -- there isn't any noticable delay. It's still a huge level of protection and far better than any home-grown solution using SHAs and salts. Once you upgrade your hardware you could increase the cost to 16. I would say that 16 is a little high at this time, and will probably result in noticeable (and annoying) delays. But if 16 works for you, by all means go for it!

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for the confirmation/clarification that a cost of 8 is safe. Never want to take any chances with stuff like this haha
8 or 10 is nowhere close to enough. 12 or 13 maybe.
erickson - can you substantiate your claim? (and your downvote)
I tried 15 rounds and my server started freezing for about 7 seconds while hashing, should I stay at 10?
If you think 7 seconds is too long, then you should stay at 10.
10

You must set the number of iterations at the maximum value which is still "tolerable" depending on the hardware you use and the patience of the users. Higher is better.

The whole point of the iteration count is to make the password processing slow -- that is, to make it slow for the attacker who "tries" potential passwords. The slower the better. Unfortunately, raising the iteration count makes it slow for you too...

As a rule of thumb, consider that an attacker will break passwords by trying, on average, about 10 millions (107) of potential passwords. If you set the iteration count so that password hashing takes 1 second for you, and you consider that the attacker can muster ten times more computing power than you, then it will take him 107*1/10 seconds, i.e. about 12 days. If you set the iteration count so that password hashing takes only 0.01 second on your PC, then the attacker is done in three hours.

Comments

3

The cost should depend on your hardware.

You should test your cost settings and aim for the 100 .. 500 ms interval. Of course, if you are working with highly sensitive information, the time could be 1000 ms or even more.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.