密码盐数据类型
我将 sha512 的密码存储为 char(128)。据我所知,这应该是它的准确数据类型。但是我不确定密码盐使用的数据类型和长度。既然它是一个随机数,我应该使用 varchar(255) 还是有二进制文件或其他东西可以使用?
并且在数据库中只需要两列,对吗? 密码_hash Password_salt
除了用户名之外,我们没有存储任何其他内容用于密码身份验证?
I have the password stored as char(128) for sha512. And as far as i read that should be the accurate data type for it. However i am not sure about the datatype and the length to use for password salt. Since it is a random number should i use varchar(255) or is there a binary or something else to use?
And in the database only two colunms are required correct?
Password _hash
Password_salt
We are not storing anything else for password authentication apart from the username?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
BINARY(64)
(或类似)列。盐应该是一个中等长度的随机字节的加密安全序列。
不要限制自己只能使用 ASCII 字符。
Use an
BINARY(64)
(or so) column.The salt should be a moderately long cryptographically secure sequence of random bytes.
Do not limit yourself to ASCII characters.