What data type to use for hashed password field and what length?

后端 未结 10 1926
孤街浪徒
孤街浪徒 2020-11-22 15:47

I\'m not sure how password hashing works (will be implementing it later), but need to create database schema now.

I\'m thinking of limiting passwords to 4-20 charact

10条回答
  •  不要未来只要你来
    2020-11-22 16:13

    You can actually use CHAR(length of hash) to define your datatype for MySQL because each hashing algorithm will always evaluate out to the same number of characters. For example, SHA1 always returns a 40-character hexadecimal number.

提交回复
热议问题