[Python-Dev] Base-96 (original) (raw)
Steve Holden steve at holdenweb.com
Sat Aug 2 04:21:16 CEST 2008
- Previous message: [Python-Dev] Base-96
- Next message: [Python-Dev] Base-96
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum wrote:
This sounds more like something to bring up in python-ideas at python.org. Also, rather than being vague about the motivation ("would be very interesting", you ought to think of a realistic use case. For example, are there existing encodings of binary data using base-96? I'm not aware of any.
On Fri, Aug 1, 2008 at 4:06 PM, 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.
[1] http://svn.python.org/view/python/trunk/Modules/binascii.c [2] http://en.wikipedia.org/wiki/ISO/IEC8859-1 96 is approximately 2^6.585
For some reason, integral powers of two seem so much more, well, POWERFUL, if you know what I mean. Frankly I think you are being either optimistic or charitable in suggesting that such a use case might exist.
There's a reason that DEC called their equivalent of base64 "6-bit encoding".
But then I wanted to keep integer division as it was, so I am clearly a techno-luddite. If the world wants fractional bits I'm sure it's only a matter of time before some genius decides to design a 67.9-bit computer.
regards Steve
Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/
- Previous message: [Python-Dev] Base-96
- Next message: [Python-Dev] Base-96
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]