密码盐数据类型

发布于 2024-10-09 08:33:41 字数 204 浏览 0 评论 0原文

我将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安人多梦 2024-10-16 08:33:41

使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文