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

Function base32_data_size

ccan/ccan/str/base32/base32.c:54–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54size_t base32_data_size(const char *str, size_t strlen)
55{
56 /* 8 chars == 5 bytes, round up to avoid overflow even though
57 * not required for well-formed strings. */
58 size_t max = (strlen + 7) / 8 * 5, padding = 0;
59
60 /* Count trailing padding bytes. */
61 while (strlen && str[strlen-1] == base32_chars[32] && padding < 6) {
62 strlen--;
63 padding++;
64 }
65
66 return max - (padding * 5 + 7) / 8;
67}
68
69static bool decode_8_chars(const char c[8], beint64_t *res, int *bytes)
70{

Callers 3

testFunction · 0.85
testFunction · 0.85
b32_decodeFunction · 0.85

Calls

no outgoing calls

Tested by 2

testFunction · 0.68
testFunction · 0.68