encoding/base64/src/encoding library
Base64 encoding (RFC 4648), with optional URL-safe alphabet and optional padding.
Single-pass, single-allocation implementation: output length is
computed exactly up front, so there's exactly one List<int> (of char
codes) allocated for the whole call - no per-3-byte-group buffers, no
list shifting, no post-hoc string surgery for the urlSafe/noPadding
options (both are handled by picking the right alphabet and output
length before the loop even starts, not by scanning/rewriting the
string afterward).