On Sun, Mar 21, 2021 at 04:38:56PM -0400, Wietse Venema wrote:

> With non-uniform input, or with input from a smaller alphabet, I
> expect that YMMV (the expansion can be less or more than 2%). For
> example 1000 null bytes expand into 2000 (100%), and when content
> requires no escaping, 998 bytes expand into 1000 (0.2%).

Yes, one of the worst-cases would be UTF-16 or UCS2, where the Latin
characters encode to a form with every other byte a NUL.  This gives you
a 50% blowup for ASCII.  Even run-length encoding of consecutive NULs
does not help.  The nice thing about base64 is that the expansion is
uniform and predictable.

-- 
    Viktor.

Reply via email to