Implementation of Crockford's Base32 Encoding?

S

samslists

Anyone know of a Python implementation of this: http://www.crockford.com/wrmg/base32.html

Google shows a Perl library. I'm sure someone must have a Python
library somewhere? :)

Thanks

[And yes...I know it won't be that hard to do...

I will do it if it doesn't already exist, but I'd much rather spend my
time on my core application.]
 
G

Gabriel Genellina

En Sun, 06 Apr 2008 06:07:18 -0300, Petite Abeille
Not sure about Crockford's Base32 encoding itself, but here is an
implementation of Bryce "Zooko" Wilcox-O'Hearn's "human-oriented
base-32 encoding":

https://zooko.com/repos/z-base-32/base32/
https://zooko.com/repos/z-base-32/base32/DESIGN

The design and rationale looks better. The Crockford version is
ill-defined in the sense that you can't recover the exact input string
length in some cases; by example both "\x00"*4 and "\x00"*5 share the same
encoding.
base-64 encoding, by example, uses '=' as pad bytes at the end to avoid
this problem.
 
S

samslists

Gabriel...

I looked at Zooko's encoding. I didn't really like that the first 16
characters weren't the same as for base 16, [0-9a-f].

I hadn't considered the need for padding. Zooko doesn't seem to use
it either. How does he get around it?

Thanks

p.s. Paul...yes it is different. :)
 
S

samslists

Sorry to reply to myself. By reading the whole document I see he does
give a few different ways one can hadle the lack of padding (including
adding it back in.) Both the specs. seem to fudge a bit on
this...I'll have to think more about it.

Gabriel...

I looked at Zooko's encoding. I didn't really like that the first 16
characters weren't the same as for base 16, [0-9a-f].

I hadn't considered the need for padding. Zooko doesn't seem to use
it either. How does he get around it?

Thanks

p.s. Paul...yes it is different. :)

En Sun, 06 Apr 2008 06:07:18 -0300, Petite Abeille
<[email protected]> escribió:
The design and rationale looks better. TheCrockfordversion is
ill-defined in the sense that you can't recover the exact input string
length in some cases; by example both "\x00"*4 and "\x00"*5 share the same
encoding.
base-64 encoding, by example, uses '=' as pad bytes at the end to avoid
this problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top