How large should my password salt be? [duplicate]

戏子无情 提交于 2019-12-05 22:19:17
Bill Karwin

I have several comments:

  • Salts should be random and unique per user, but they don't have to be a hash digest. The idea of a salt is just to make the hash digest unique per user to resist dictionary attacks and rainbow table attacks. The salt doesn't add to the strength of the hash digest algorithm, regardless of the salt's length.

  • DES uses 12 bits for the salt. Updated UNIX password systems use more, up to 128 bits.

  • If you want stronger passwords, consider using bcrypt or PBKDF2.

  • FWIW, a SHA-512 hash digest (encoded as hex digits) is always exactly 128 characters, regardless of the length of the input. So I'd use CHAR(128) instead of VARCHAR(128). Use BINARY(2) or BINARY(3) for the salt.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!