diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2020-08-27 11:03:21 +0200 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2020-09-21 10:13:34 +0200 |
commit | 7be6ff61875a8d5d2335bff5d1f16ba40557adb0 (patch) | |
tree | a2c60b8c3ad2144f697f334c05b6f6a508743459 /src/util/strencodings.h | |
parent | e0d73573a37bf4b519f6f61e5678572d48a64517 (diff) | |
download | bitcoin-7be6ff61875a8d5d2335bff5d1f16ba40557adb0.tar.xz |
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>
Diffstat (limited to 'src/util/strencodings.h')
-rw-r--r-- | src/util/strencodings.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/util/strencodings.h b/src/util/strencodings.h index 1519214140..1a217dd12d 100644 --- a/src/util/strencodings.h +++ b/src/util/strencodings.h @@ -52,8 +52,20 @@ std::string EncodeBase64(Span<const unsigned char> input); std::string EncodeBase64(const std::string& str); std::vector<unsigned char> DecodeBase32(const char* p, bool* pf_invalid = nullptr); std::string DecodeBase32(const std::string& str, bool* pf_invalid = nullptr); -std::string EncodeBase32(Span<const unsigned char> input); -std::string EncodeBase32(const std::string& str); + +/** + * Base32 encode. + * If `pad` is true, then the output will be padded with '=' so that its length + * is a multiple of 8. + */ +std::string EncodeBase32(Span<const unsigned char> input, bool pad = true); + +/** + * Base32 encode. + * If `pad` is true, then the output will be padded with '=' so that its length + * is a multiple of 8. + */ +std::string EncodeBase32(const std::string& str, bool pad = true); void SplitHostPort(std::string in, int& portOut, std::string& hostOut); int64_t atoi64(const std::string& str); |