密码哈希:PBKDF2(使用 sha512 x 1000)与 Bcrypt
我一直在阅读有关 Gawker 事件的文章,并且出现了几篇有关仅使用 bcrypt 进行哈希的文章密码,我想确保我的散列机制足够安全,以避免切换到另一种方法。在我当前的应用程序中,我选择了使用 sha2-512 和至少 1000 次迭代的 PBKDF2 实现。
我可以询问有关使用 PBKDF2 与 Bcrypt 的意见以及我是否应该实施更改?
I've been reading about the Gawker incident and several articles have cropped up regarding only using bcrypt to hash passwords and I want to make sure my hashing mechanism is secure enough to avoid switching to another method. In my current application I have opted for a PBKDF2 implementation utilising sha2-512 and a minimum of 1000 iterations.
Can I ask for opinions on using PBKDF2 vs Bcrypt and whether or not I should implement a change?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 2022 年开始,最好切换到内存困难的函数,例如 scrypt 或 Argon2。 Bcrypt 也可能是一种选择,但它并不难记忆。
至于 PBKDF2,在 2000 年就建议使用 1000 次迭代,现在您可能想要更多。
另外,使用 bcrypt 时应该更加小心:
来自 scrypt 论文 [PDF]
也就是说,还有 scrypt。
如果没有上述 scrypt 论文中的表格,任何比较都是不完整的:
使用的 PBKDF2-HMAC-SHA256 的迭代计数为 86,000 和 4,300,000。
As of 2022, it's best to switch to a memory-hard function, such as scrypt or Argon2. Bcrypt could also be an option, but it's not memory-hard.
As for PBKDF2, the recommendation to use 1000 iterations was made in year 2000, now you'd want much more.
Also, you should take more care when using bcrypt:
From scrypt paper [PDF]
That said, there's also scrypt.
Any comparisons would be incomplete without the table from the scrypt paper mentioned above:
Iteration counts for PBKDF2-HMAC-SHA256 used there are 86,000 and 4,300,000.
评论(回复:标题):
我的意见:
使用 PBKDF2 而不是 Bcrypt。 (我只是对SHA比Blofish更有信心,没有任何理由)
至于你是否应该“实施改变”,我不知道你在问什么。
编辑以更清楚地将加密/散列讨论与陈述我的偏好w/r/t算法分开。
Comment (re: the title):
My opinion:
Use PBKDF2 over Bcrypt. (I just have more faith in SHA than Blofish, for no reason)
As for whether you should 'implement a change', I don't know what you are asking.
Edited to more clearly separate the encryption / hashing discussion from stating my preferences w/r/t algorithm.