使用加密货币++使用 SHA1 生成随机哈希值
我需要使用 Crypto++、SHA1 生成随机哈希。目前我有:
#include <cryptopp/sha.h>
#include <cryptopp/filters.h>
#include <cryptopp/hex.h>
...
CryptoPP::SHA1 sha1;
string source = "Hello"; //This will be randomly generated somehow
string hash = "";
StringSource(source, true, new HashFilter(sha1, new HexEncoder(new StringSink(hash))));
当我进行编译时,我收到以下错误报告:
error: expected type-specifier before 'HashFilter'
error: expected ')' before 'HashFilter'
error: 'StringSource' was not declared in this scope
任何人都可以帮助我让它工作吗?使用这个库有更简单的方法来执行此操作吗?我是 Crypto++ 的新手,因此非常感谢所有帮助。
谢谢。
I need to generate a random hash using Crypto++, using SHA1. At the moment I have:
#include <cryptopp/sha.h>
#include <cryptopp/filters.h>
#include <cryptopp/hex.h>
...
CryptoPP::SHA1 sha1;
string source = "Hello"; //This will be randomly generated somehow
string hash = "";
StringSource(source, true, new HashFilter(sha1, new HexEncoder(new StringSink(hash))));
When I come to compile, I get the following error reported:
error: expected type-specifier before 'HashFilter'
error: expected ')' before 'HashFilter'
error: 'StringSource' was not declared in this scope
Can anyone help me to get this working? Is there a much simpler way of performing this using this library? I am new to using Crypto++ so all help will be much appreciated.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需正确且仔细地指定您的名称空间即可:
Just specify your namespaces correctly and carefully: