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

后端 未结 10 1839
孤街浪徒
孤街浪徒 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:26

    As a fixed length string (VARCHAR(n) or however MySQL calls it). A hash has always a fixed length of for example 12 characters (depending on the hash algorithm you use). So a 20 char password would be reduced to a 12 char hash, and a 4 char password would also yield a 12 char hash.

提交回复
热议问题