| 164 | }; |
| 165 | |
| 166 | inline padding count_padding(const std::string& base, const std::vector<std::string>& fills) { |
| 167 | for (const auto& fill : fills) { |
| 168 | if (base.size() < fill.size()) continue; |
| 169 | // Does the end of the input exactly match the fill pattern? |
| 170 | if (base.substr(base.size() - fill.size()) == fill) { |
| 171 | return padding{1, fill.length()} + |
| 172 | count_padding(base.substr(0, base.size() - fill.size()), fills); |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | return {}; |
| 177 | } |
| 178 | |
| 179 | inline std::string encode(const std::string& bin, const std::array<char, 64>& alphabet, |
| 180 | const std::string& fill) { |