当我这样做时,在 python 上:
encoded = base64.b32encode("1ACC64E9510C32CE8E34".decode('hex'))
我明白了DLGGJ2KRBQZM5DRU
。在 Crypto++ 上:
std::string decoded2;
std::string first_20="1ACC64E9510C32CE8E34";
StringSource ssv(first_20, true /*pumpAll*/,
new HexDecoder(
new StringSink(decoded2)
) // HexDecoder
); // StringSource
boost::algorithm::to_lower(decoded2);
StringSource ss( decoded2, true,
new Base32Encoder(
new StringSink(hash_sink)
) // Base64Decoder
); // StringSource
std::cout<<"encoded raw:"<<hash_sink<<std::endl;
我知道DMGGJ4MTBS3N7DTW
这是错误的。
有没有办法可以在 c++ 中对上面的字符串进行编码并获得与 python 相同的结果?