MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / EncodeBase32

Function EncodeBase32

src/util/strencodings.cpp:143–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143std::string EncodeBase32(std::span<const unsigned char> input, bool pad)
144{
145 static const char *pbase32 = "abcdefghijklmnopqrstuvwxyz234567";
146
147 std::string str;
148 str.reserve(CeilDiv(input.size(), 5u) * 8);
149 ConvertBits<8, 5, true>([&](int v) { str += pbase32[v]; }, input.begin(), input.end());
150 if (pad) {
151 while (str.size() % 8) {
152 str += '=';
153 }
154 }
155 return str;
156}
157
158std::string EncodeBase32(std::string_view str, bool pad)
159{

Callers 6

DestBinToAddrFunction · 0.85
OnionToStringFunction · 0.85
ToStringAddrMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
FUZZ_TARGETFunction · 0.85
ConsumeScalarRPCArgumentFunction · 0.85

Calls 6

CeilDivFunction · 0.85
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_TARGETFunction · 0.68
ConsumeScalarRPCArgumentFunction · 0.68