|
|
@ -347,7 +347,7 @@ std::string KeyIO::EncodeIVK(const libzcash::SaplingIncomingViewingKey& ivk) |
|
|
|
// See calculation comment below
|
|
|
|
data.reserve((serkey.size() * 8 + 4) / 5); |
|
|
|
ConvertBits<8, 5, true>([&](unsigned char c) { data.push_back(c); }, serkey.begin(), serkey.end()); |
|
|
|
std::string ret = bech32::Encode(keyConstants.Bech32HRP(KeyConstants::SAPLING_INCOMING_VIEWING_KEY), data); |
|
|
|
std::string ret = bech32::Encode(Params().Bech32HRP(CChainParams::SAPLING_INCOMING_VIEWING_KEY), data); |
|
|
|
memory_cleanse(serkey.data(), serkey.size()); |
|
|
|
memory_cleanse(data.data(), data.size()); |
|
|
|
return ret; |
|
|
@ -357,7 +357,7 @@ libzcash::SaplingIncomingViewingKey KeyIO::DecodeIVK(const std::string& str) |
|
|
|
{ |
|
|
|
std::vector<unsigned char> data; |
|
|
|
auto bech = bech32::Decode(str); |
|
|
|
if (bech.first == keyConstants.Bech32HRP(KeyConstants::SAPLING_INCOMING_VIEWING_KEY) && |
|
|
|
if (bech.first == Params().Bech32HRP(CChainParams::SAPLING_INCOMING_VIEWING_KEY) && |
|
|
|
bech.second.size() == ConvertedSaplingIncomingViewingKeySize) { |
|
|
|
// Bech32 decoding
|
|
|
|
data.reserve((bech.second.size() * 5) / 8); |
|
|
|