473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

base-96

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/tr...les/binascii.c
[2] http://en.wikipedia.org/wiki/ISO/IEC_8859-1
Aug 1 '08 #1
6 5108
Kless <jo*******@googlemail.comwrote:
>
I think that would be very interesting thay Python would have a module
for working on base 96 too. [1]
Well, then, write one.

However, I'm not sure I see the point. Base 64 is convenient because 6
bits becomes 8 bits exactly, so 3 bytes translates exactly to 4 characters.
With base 96, you would end up doing division instead of just shifting and
masking; the conversion isn't as "neat".
>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.
This leaves some tricky issues. How will you denote the end of a base 96
sequence? If every printable character can be part of the ciphertext, what
can you use as an end marker or a padding character?
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Aug 2 '08 #2
Kless <jo*******@googlemail.comwrote:
>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, ti**@probo.com
Providenza & Boekelheide, Inc.
Aug 2 '08 #3
see
http://en.wikipedia.org/wiki/Base-85
for something more practical

Aug 2 '08 #4
On 3 ago, 00:16, Tim Roberts <t...@probo.comwrote:
Kless <jonas....@googlemail.comwrote:
I think that would be very interesting thay Python would have a module
for working on base 96 too. [1]

Well, then, write one.

However, I'm not sure I see the point. *Base 64 is convenient because 6
bits becomes 8 bits exactly, so 3 bytes translates exactly to 4 characters.
With base 96, you would end up doing division instead of just shifting and
masking; the conversion isn't as "neat".
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.

This leaves some tricky issues. *How will you denote the end of a base 96
sequence? *If every printable character can be part of the ciphertext, what
can you use as an end marker or a padding character?
Well, it could be used an Unicode (UTF-8) character -wich isn't in
ASCII set-, if it isn't possible use a non-printable char.
Aug 3 '08 #5
On 3 ago, 00:33, Terry Reedy <tjre...@udel.eduwrote:
seehttp://en.wikipedia.org/wiki/Base-85
for something more practical
In this thread [1] --a mirror group of python-dev mailing list-- where
I sent the same post, has been named too that enconding way.
[1] http://groups.google.com/group/pytho...43ecf222948167
Aug 3 '08 #6
On 3 ago, 00:31, Tim Roberts <t...@probo.comwrote:
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.
There would be that make tests, it's possible that there isn't problem
for any non-printable chars.
>
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.
Yes, it's easy in python, but the ideal would be make the arithmetic
in C as it's implemented for base 64.
Aug 3 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jef Driesen | last post by:
Suppose I have an abstract base class that looks like this: template <typename T> class base { public: // Typedefs typedef double value_type; typedef std::size_t size_type; public: //...
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
6
by: Taran | last post by:
Hi All, I tried something with the C++ I know and some things just seem strange. consider: #include <iostream> using namespace std;
0
by: robert | last post by:
Hi all, I'm having a hard time resolving a namespace issue in my wsdl. Here's an element that explains my question, with the full wsdl below: <definitions name="MaragatoService"...
11
by: jyck91 | last post by:
// Base Conversion // Aim: This program is to convert an inputted number // from base M into base N. Display the converted // number in base N. #include <stdio.h> #include <stdlib.h>...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.