我需要使用 SHA1 使用 Crypto++ 生成随机散列。目前我有:
#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++ 的新手,因此将不胜感激所有帮助。
谢谢。