MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / add_base64_padding

Function add_base64_padding

libcppcryptfs/util/util.cpp:165–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165static const char *
166add_base64_padding(const char *str, string& storage)
167{
168 // storage won't contain padded string if no padding needed
169
170 size_t len = strlen(str);
171
172 if (len % 4 == 0)
173 return str;
174
175 size_t npad = 4 - len % 4;
176
177 storage.reserve(len + npad);
178
179 storage = str;
180
181 storage.resize(len + npad, '=');
182
183 return storage.c_str();
184}
185
186static const char *
187remove_base64_padding(string& str)

Callers 1

base64_decodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected