You can use multiple hashes in your database, it just takes a little extra effort. It’s worth it, but if you think that you will be able to support additional formats in the future. I often use password entries such as
{hashId} $ {salt} $ {hashed password}
where "hashId" is just some number that I use internally to recognize this, for example, I use SHA1 with a specific hash pattern; “salt” is a basic 64-coded random salt; and "hashed password" is a base64 encoded hash. If you need to transfer hashes, you can intercept people with the old password and make changes to your password the next time you log in.
As already mentioned, you want to be careful with your hashes, since it is easy to do something that is really not secure, for example, H (salt, password) is much weaker than H (password, salt), but at the same time you want to balance the effort put into this with the meaning of the site content. I often use H (H (password, salt), password).
Finally, the cost of using base64-encoded passwords is modest compared to the benefits of using various tools that expect text data. Yes, they should be more flexible, but are you ready to tell your boss that he cannot use his favorite third-party tool, because you want to save several bytes for recording ?:-)
Edited to add another comment: if I proposed to intentionally use an algorithm that burned even the 1 / 10th second of hashing each password, I was lucky enough to just laugh out of my boss office. (Not so lucky? He planned something to discuss my next annual review.) Burning is not a problem when you have dozens or even hundreds of users. If you click 100 thousand users, you, as a rule, simultaneously include several people. You need something fast and strong, not slow and strong. "But what about credit card information?" at best insincere, because the stored credit card information should not be anywhere near your regular database, and in any case will be encrypted by the application, and not by individual users.
bgiles Mar 23 '09 at 16:17 2009-03-23 16:17
source share