mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 10:42:23 +02:00
net: recognize TORv3/I2P/CJDNS networks
Recognizing addresses from those networks allows us to accept and gossip them, even though we don't know how to connect to them (yet). Co-authored-by: eriknylund <erik@daychanged.com>
This commit is contained in:
@ -201,20 +201,24 @@ std::string DecodeBase64(const std::string& str, bool* pf_invalid)
|
||||
return std::string((const char*)vchRet.data(), vchRet.size());
|
||||
}
|
||||
|
||||
std::string EncodeBase32(Span<const unsigned char> input)
|
||||
std::string EncodeBase32(Span<const unsigned char> input, bool pad)
|
||||
{
|
||||
static const char *pbase32 = "abcdefghijklmnopqrstuvwxyz234567";
|
||||
|
||||
std::string str;
|
||||
str.reserve(((input.size() + 4) / 5) * 8);
|
||||
ConvertBits<8, 5, true>([&](int v) { str += pbase32[v]; }, input.begin(), input.end());
|
||||
while (str.size() % 8) str += '=';
|
||||
if (pad) {
|
||||
while (str.size() % 8) {
|
||||
str += '=';
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string EncodeBase32(const std::string& str)
|
||||
std::string EncodeBase32(const std::string& str, bool pad)
|
||||
{
|
||||
return EncodeBase32(MakeUCharSpan(str));
|
||||
return EncodeBase32(MakeUCharSpan(str), pad);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> DecodeBase32(const char* p, bool* pf_invalid)
|
||||
|
Reference in New Issue
Block a user