Comprehensive information about hash salts

后端 未结 4 1295
旧巷少年郎
旧巷少年郎 2021-01-06 00:33

There are a lot of questions about salts and best practices, however most of them simply answer very specific questions about them. I have several questions which feed into

4条回答
  •  长发绾君心
    2021-01-06 01:09

    1) No. An attacker will probably dump everything on your system and will find the salts eventually (though this will be annoying).

    2) Yes, there is a small benefit-this covers you if another system uses an identical hashing scheme as you, and some of your salts overlap.

    3) The only requirement of a salt is that it's unique per user. Length is irrelevant for security-salts are not keys despite widespread confusion. 64 bit random salts will never repeat. You can also use a 32-bit counter, or just use the user IDs if those are unique.

    4) The only reason salts even need randomness (if you use random salts) is to ensure uniqueness. This is statistical randomness, not cryptographic randomness (impossibility of guessing). So any random number library will do.

提交回复
热议问题