C++如何制作带有boost的简单sha256发生器?
我需要一个简单的 sha256 生成器类字符串。我不想为此构建大型库,例如 openSSL 或 Cripto++ - 我想要的只是将字符串转换为 sha256。如何创建这样的类或从哪里获取它?
I need a simple string to sha256 generator class. I do not want to build big libraries for that like openSSL or Cripto++ - all I want is to turn strings into sha256. How to create such class or where to get it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
正如其他人所说,我的印象是 SHA256 下的散列不足以简单地将自己实现为更大编码项目的子集。如果您查看SHA-2 的维基百科页面,您会注意到一些漂亮的内容密集的数学。如果您想要实际的加密摘要(数学理论本身),可以找到这里。如果您像大多数程序员一样,重点不在于安全性,那么您可能只想使用其他人经过测试和尝试的实现。您可以在此处找到一些。让我知道这是否有帮助。抱歉,我无法用直接代码或类似性质的东西来回答您的问题。
Like others have said, I was under the impression that hashing under SHA256 is not trivial enough to simply implement yourself as a subset of a bigger coding project. If you take a look at the wikipedia page for SHA-2, you will notice some pretty intense math. If you would like the actual encryption abstract (the math theory itself), it can be found here. If you're like most programmers whose emphasis is not in security, then you will probably want to simply use someone else's tested and tried implementation. You can find a good few here. Let me know if this helped. Sorry I couldn't answer your question with straight code or something of that nature.
您可以直接在 RFC 6234 的第 8 节中找到 C 源代码。请务必检查勘误表。
You find C source code directly in the section 8 of RFC 6234. Make sure you check the errata also.
你想要这个吗?
转到 http://www.saphir2.com/sphlib/
并下载它。它受 GPL 约束。 请注意查看 sha2.c
,它没有很多文档。它是为那些已经知道自己在做什么的人而设置的。
you want this?
go to http://www.saphir2.com/sphlib/
and download it. it's under the GPL. look in sha2.c
beware, it doesn't have a lot of documentation. it's set up for people who already know what they're doing.
GNU coreutils 有一个非常简单的源代码。
只需下载 coreutils,他们甚至有一个可以构建的测试套件,并且源代码充满了注释和文档。
GNU coreutils has a very simple source code.
just download coreutils, they even have a test suite you can build, and the source code is full of comments and docs.