base-96

Tim Roberts timr at probo.com
Sun Aug 3 01:31:30 CEST 2008


Kless <jonas.esp at googlemail.com> wrote:

>I think that would be very interesting thay Python would have a module
>for working on base 96 too. [1]
>
>It could be converted to base 96 the digests from hashlib module, and
>random bytes used on crypto (to create the salt, the IV, or a key).
>
>As you can see here [2], the printable ASCII characters are 94
>(decimal code range of 33-126). So only left to add another 2
>characters more; the space (code 32), and one not-printable char
>(which doesn't create any problem) by last.

Whether it creates problems depends on how you intend to use it.  The
biggest use for Base64, for instance, is in translating binary files to a
form where they can be send via email using only printable characters.  If
you use a non-printable character, that's a problem for email.

With Base64, 3 bytes becomes 4.  With Base96, 5 bytes becomes 6.  So, you
would reduce the conversion penalty from 1.33 down to 1.17.

It's not hard to write modules to translate from binary to Base96 and back
again, and doing so would be a great exercise to explore the issues in this
kind of encoding.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list