MCPcopy Create free account
hub / github.com/ElementsProject/elements / EncodeBase32

Function EncodeBase32

src/util/strencodings.cpp:200–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200std::string EncodeBase32(Span<const unsigned char> input, bool pad)
201{
202 static const char *pbase32 = "abcdefghijklmnopqrstuvwxyz234567";
203
204 std::string str;
205 str.reserve(((input.size() + 4) / 5) * 8);
206 ConvertBits<8, 5, true>([&](int v) { str += pbase32[v]; }, input.begin(), input.end());
207 if (pad) {
208 while (str.size() % 8) {
209 str += '=';
210 }
211 }
212 return str;
213}
214
215std::string EncodeBase32(const std::string& str, bool pad)
216{

Callers 6

DestBinToAddrFunction · 0.85
OnionToStringFunction · 0.85
ToStringIPMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
FUZZ_TARGET_INITFunction · 0.85
ConsumeScalarRPCArgumentFunction · 0.85

Calls 5

MakeUCharSpanFunction · 0.85
reserveMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 3

BOOST_AUTO_TEST_CASEFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68
ConsumeScalarRPCArgumentFunction · 0.68