6 ms·
Of all the sites and people, I expect Jeff Atwood and Joel Spolsky to have followed best practices in storing user passwords. Jeff wrote this in 2007: > Do no
by jve 7y ago
Of all the sites and people, I expect Jeff Atwood and Joel Spolsky to have followed best practices in storing user passwords.
Jeff wrote this in 2007:
> Do not invent your own "clever" password storage scheme
> Never store passwords as plaintext.
> Add a long, unique random salt to each password you store.
> Use a cryptographically secure hash. I think Thomas hates MD5 so very much it makes him seem a little crazier than he actually is. But he's right. MD5 is vulnerable. Why pick anything remotely vulnerable, when you don't have to? SHA-2 or Bcrypt would be a better choice.
https://blog.codinghorror.com/youre-probably-storing-passwords-incorrectly/ https://blog.codinghorror.com/youre-probably-storing-passwor...
Another topic on passwords: https://blog.codinghorror.com/the-dirty-truth-about-web-passwords/ https://blog.codinghorror.com/the-dirty-truth-about-web-pass...
- tgsovlerkhgsel 7y ago> MD5 is vulnerable. Why pick anything remotely vulnerable, when you don't have to? SHA-2 For the purpose of hashing passwords, there's no significant difference between MD5 and SHA-2. Both are awful choices. Edit: Actually, SHA-2 may be worse because CPUs have hardware acceleration and thus the attacker may be able to crack it somewhat faster than MD5.
- zenexer 7y agoIt’s definitely not worse—MD5 is faster with GPUs—but plain SHA-2 isn’t much better, either.
- dagenix 7y ago> SHA-2 or Bcrypt would be a better choice. As the sibling comment points out, SHA-2 is worthless for storing passwords. A GPU can crank through an obscene number of SHA-2 hashes per second. Bcrypt is is intentionally much slower and harder to use a GPU to brute force. The two algorithms are almost totally unrelated and it's concerning they were mentioned together.
- TeMPOraL 7y agoSure. But that advice was written 12 years ago. I'd be surprised if they didn't update their password storage since then.
- krzyk 7y agoHow do you update password storage if you don't store the passwords only hashes? You could upgrade it for new users, but for old ones? (e.g. I don't change passwords often)
- TeMPOraL 7y agoYou ask people to change their passwords, and when they do so, you store them with the new scheme. You can do that by e.g. requiring everyone to change their password on their next login/visit.
- icebraining 7y agoYou don't even need to ask people to change their passwords; when they login, you have a copy of the original password, so you can just store the new hash over the old.
- Crinus 7y agoYou could rehash the password the next time the user logs in.
- ShinTakuya 7y agoI updated a DB from MD5 to BCrypt at my last job. Essentially on the next login I updated the password (since the password isn't hashed on the client end). So all active users got switched over. After a relatively short period I reset the remaining passwords and forced users to send password reset emails to login.
- erpellan 7y agoOnion hash: hash the existing hash with the new algorithm.