How to upgrade a password storage scheme (change hashing-algorithm)

后端 未结 7 1094
庸人自扰
庸人自扰 2021-02-02 09:33

I\'ve been asked to implement some changes/updates to an intranet-site; make it \'future proof\' as they call it.

We found that the passwords are hashed using the MD5

7条回答
  •  难免孤独
    2021-02-02 10:09

    I'm not entirely sure about this option, since I'm not an expert on cryptography. Please correct me if I'm wrong at some point here!

    I think Dave P. has clearly the best option.

    ... but. There is an automagic solution - hash the older hashes themselves. That is, take the current hashes, and hash them again with a stronger algorithm. Notice that as far as I understand, you don't get any added security from hash length here, only the added cryptographical complexity of the new algorithm.

    The problem is, of course, that checking a password would then have to go through both hashes. And you'd have to do the same for evey new password as well. Which is, well, pretty much silly. Unless you want to use a similar scheme like Dave P. explained to eventually graduate back to single-hashed passwords with the new hashing algorithm... in which case, why even bother with this? (Granted, you might use it in a flashy "Improved security for all passwords, applied immediately!"-way at a presentation to corporate suits, with a relatively straight face...)

    Still, it's an option that can be applied immediately to all current passwords, without any gradual migration phase.

    But boy, oh boy, is someone going to have a good laugh looking at that code later on! :)

提交回复
热议问题