MCPcopy Create free account
hub / github.com/ElementsProject/lightning / base32_encode

Function base32_encode

ccan/ccan/str/base32/base32.c:140–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140bool base32_encode(const void *buf, size_t bufsize, char *dest, size_t destsize)
141{
142 while (bufsize) {
143 int bytes = 5;
144
145 if (bytes > bufsize)
146 bytes = bufsize;
147
148 if (destsize < 8)
149 return false;
150 encode_8_chars(dest, buf, bytes);
151 buf = (const char *)buf + bytes;
152 bufsize -= bytes;
153 destsize -= 8;
154 dest += 8;
155 }
156 if (destsize != 1)
157 return false;
158 *dest = '\0';
159 return true;
160}

Callers 3

testFunction · 0.85
testFunction · 0.85
b32_encodeFunction · 0.85

Calls 1

encode_8_charsFunction · 0.85

Tested by 2

testFunction · 0.68
testFunction · 0.68