[Python-Dev] Base-96

"Martin v. Löwis" martin at v.loewis.de
Sat Aug 2 19:09:57 CEST 2008


Josiah Carlson wrote:
> The standard high-bit-density encoding past base-64 is base-85
> (http://en.wikipedia.org/wiki/Ascii85), which encodes 4 binary bytes
> as 5 ascii bytes, versus 3 binary bytes as 4 ascii bytes.  It works,
> is an RFC somewhere,

RFC 1924, published on April 1, 1996, to shorten the representation
of IPv6 addresses, so that you can write

  ssh '4)+k&C#VzJ4br>0wv%Yp'

instead of having to write

  ssh 1080:0:0:0:8:800:200C:417A

Most notably, section 7 (implementation issues) points out

   Many current processors do not find 128 bit integer arithmetic, as
   required for this technique, a trivial operation.  This is not
   considered a serious drawback in the representation, but a flaw of
   the processor designs.

For arbitrary-sized data, you'd have to give up 128-bit arithmetic,
of course, and represent the input data to encode as a long integer.

Regards,
Martin

P.S. Just in case it isn't clear: I would oppose any specific proposal
to add this Ascii85 algorithm to the standard library. It would sound
like we don't have any real problems to solve.


More information about the Python-Dev mailing list