请小例子。我尝试将其用作文档中的内容,但我不知道如何使用。
讯息:
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<T, A>::operator+='连接两个字节*(secblock),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34479894/