Reading this topic How critical is it to keep your password length secret? following scenario comes to my mind:
Assume I've a web application (PHP written using password_hash()
) using salted password hashes to save user passwords. A user tries now to login. The server now has to do some tasks:
- Calculate hash of provided password (of course with cost factors)
- Compare hash with saved hash
Assuming that I can save the length of a password without any security issues, I could change the taskflow:
- Compare length of provided password with saved length (does not match -> return)
- If match calculate hash of provided password (of course with cost factors)
- Compare hash with saved hash
What do you think? Would this be "economic" because I save computing time/resources (or does it slow down the process overall, because it would only save time if no valid password was provided)? Or would that be an security issue?