如何在 C# 中使用 BouncyCastle 进行 Blowfish 单向哈希?
我见过很多关于 Blowfish 和 C# 的问题,通常的答案是 BouncyCastle。然而,该项目基本上没有文档,我无法找到目录结构的方法,甚至无法找到单元测试作为示例。我的意思是,Blowfish 被称为 Asn1、Bcpg、Crypto(一般?)、EC、Ocsp、Pkcs 还是什么?我缺乏了解源代码中所有首字母缩略词含义的领域知识。
是否有任何有用的文章或博客或已成功使用 C# BouncyCastle API for Blowfish 的内容?我的主要需求是使用 Blowfish 进行密码哈希处理。
I've seen a ton of questions asked about Blowfish and C# and the usual answer is BouncyCastle. However, the project has basically no documentation and I can't find my way around the directory structure to even find unit tests as examples. I mean, is Blowfish known as Asn1, Bcpg, Crypto(in general?), EC, Ocsp, Pkcs, or what? I lack the domain knowledge of knowing what all of the acronyms in the source code means.
Is there any useful articles or blogs or something that has succeeded in using the C# BouncyCastle API for Blowfish? My primary need is to use Blowfish for password hashing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于密码哈希,我建议使用内部使用 Blowfish 的 bcrypt。使用 bcrypt 的优点是您可以轻松配置生成输出哈希的成本。这很重要,因为许多流行的哈希算法的最大问题是它们运行速度非常快,这使得暴力攻击可以通过许多排列来找到匹配项。通过指定较大的工作因子,您可以使其运行缓慢(从计算机角度来看,但从人类角度来看仍然很快),因此暴力攻击变得不可行。
有 C# 实现已经可用。
For password hashing I would recommend going with bcrypt which internally uses Blowfish. The advantage of using bcrypt is that you can easily configure how expensive it is in generating your output hash. This is important as the biggest problem with many popular hash algorithms is that they work very quickly and this allows a brute force attack to run through many permutations to find a match. By specifying a large work factor you can make it slow to run (in computer terms but still fast in human terms) and so a brute force attack becomes unfeasable.
There are C# implementations already available.
您还应该查看: 为什么 BCrypt.netGenerateSalt(31) 返回立即?
以及 codeplex 实现: bcrypt.codeplex.com
Also you should check out: Why does BCrypt.net GenerateSalt(31) return straight away?
And the codeplex implementation: bcrypt.codeplex.com