请举个例子。我试过在文档中使用它,但我不明白如何使用。
消息:
main.cpp|97|error: no matching function for call to
'CryptoPP::SecBlock<unsigned char>::operator+=(CryptoPP::SecBlock<unsigned char>*)'
secblock.h|568|note: candidate:
CryptoPP::SecBlock<T, A>& CryptoPP::SecBlock<T, A>::operator+=(const CryptoPP::SecBlock<T, A>&)
[with T = unsigned char; A = CryptoPP::AllocatorWithCleanup<unsigned char>]
secblock.h|568|note:
no known conversion for argument 1 from 'CryptoPP::SecBlock<unsigned char>*'
to 'const CryptoPP::SecBlock<unsigned char>&'
我的代码:
SecBlock<byte, AllocatorWithCleanup<byte> > hash_ripemd160_temp;
RIPEMD160().CalculateDigest(hash_ripemd160_temp, hash_sha256, 32);
SecBlock<byte, AllocatorWithCleanup<byte> > hash_ripemd160 = L0_byte;
hash_ripemd160 = SecBlock< byte , AllocatorWithCleanup<byte > >::operator+= (&hash_ripemd160_temp);
在文档中是这样的:
SecBlock<byte , AllocatorWithCleanup<byte > >& SecBlock< byte , AllocatorWithCleanup<byte > >::operator+= (const SecBlock< byte , AllocatorWithCleanup<byte > > &t)
Append contents from another SecBlock.
Parameters
t the other SecBlock
Internally, this SecBlock calls Grow and then copies the new content.
If the memory block is reduced in size, then the unused area is set to 0.
文件 secblock.h 第 568 行的定义。
最佳答案
调用运算符函数最简单的方法是只使用运算符:
hash_ripemd160 += hash_ripemd160_temp;
如果你想直接调用它(我不推荐)你必须这样调用它,因为它是一个成员函数:
hash_ripemd160.operator += (hash_ripemd160_temp);
关于c++ - 如何将两个字节 * (secblock) 与运算符 'secblock<T, A>::operator+=' 连接起来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34479894/