我应该使用 base64 编码将密码存储在数据库表中吗?

发布于 2024-12-02 23:49:35 字数 163 浏览 1 评论 0原文

我正在使用 PBKDF2 加密来用盐哈希密码。 应用 Base64 编码后,我应该将哈希密码和盐存储在数据库中吗?

如果我确实使用该编码,那么密码长度将从 64 变为 88,这比我不使用它时需要更多的存储空间。

使用编码有哪些优点和缺点?

我也应该将它应用于盐吗?

I am using PBKDF2 encryption to hash password with salt.
should I store hashed password and salt in database after applying base64 encoding?

If I do use the encoding, then the password length becomes 88 from 64, which requires more storage than when I am not using it.

What are advantages and disadvantages for using the encoding?

should I apply it to salts too?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

提赋 2024-12-09 23:49:35

从安全方面来看,存储纯字节和存储它们的 Base64 编码之间没有区别。

如果您存储纯字节,请确保为您的列选择正确的数据类型(例如二进制数据类型,而不是字符数据类型)。如果存储 base64,则可以使用采用 US-ASCII 编码的字符列。

Base64 的优点是人们可以更轻松地查看数据并查看它是否与其他数据相同,但仅此而已 - 您也可以在查询数据后轻松进行编码。

From the security side, there is no difference between storing pure bytes, and storing a Base64-encoding of them.

If you store pure bytes, make sure you select the right datatype (e.g. a binary one, not a character one) for your column. If you store base64, you can use a character column with US-ASCII encoding.

Base64 has the advantage that a human can more easily look at the data and see if it is the same as some other, but this is about it - you could easily do the encoding after querying the data, too.

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