“Hasty Pudding”的示例源代码密码?
我需要使用“Hasty Pudding”密码,因为它能够使用 n 位的块大小。 SO 中的一些问题提到了它,但它们仅指向维基百科文章。
AFAIK 密码属于公共领域,但我还没有找到任何实现源代码。
有人见过吗?
(我最终会编码它是 C# 语言,但欢迎任何语言的源代码)
I need to use the "Hasty Pudding" cipher because its ability to use a block size of n bits. Some questions in SO mention it but they only point to the Wikipedia article.
AFAIK the cipher is in public domain, but I haven't found any implemmentation source code.
Anyone has seen it?
(I'll finally code it in C#, but source code in any language is welcome)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是正确的,该密码属于公共领域。事实上,我想知道还没有人向您指出源代码,因为它是 Bruce Schneier 的“应用密码学,第二版”随附源代码的一部分。
保持简短......在 https://www.schneier.com/book-applied- source.html,你会发现
可通过 https://www.schneier.com/sccd/HPC.ZIP 免费下载 包含以下源代码,这应该正是您正在寻找的内容...
std_defs.h
hpc.c
You are correct that the cipher is in public domain. In fact, I'm wondering that no one pointed you to the source code yet because it's part of the source code that accompanies "Applied Cryptography, Second Edition" by Bruce Schneier.
Keeping it short... at https://www.schneier.com/book-applied-source.html, you will find
The download which is available for free via https://www.schneier.com/sccd/HPC.ZIP contains the following sourcecode, which should be exactly what you're looking for…
std_defs.h
hpc.c
认真地,重新考虑这个决定。仓促布丁几乎没有研究支持它,这意味着你真的不知道它是否安全。另外,正如维基百科文章所说:
这是一个非常糟糕的问题——如果密钥冲突,它们可以用来解密彼此的密文。
不用担心可变的密码块大小,而是解决您的输入问题。存在许多选项,包括在块前添加长度字段以及使用随机位填充到密码块大小。
Seriously, reconsider this decision. Hasty Pudding has very little research supporting it, which means you really have no idea if it is secure or not. Plus, as the Wikipedia article says:
That's a really bad problem - if keys collide, they can be used to decrypt each other's cipher text.
Instead of worrying about variable cipher block size, fix your input problem. Lots of options exist, including prefixing the block with a length field and padding out to the cipher block size with random bits.