Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32703
| From | Andriy Kornatskyy <andriy.kornatskyy@live.com> |
|---|---|
| Subject | RE: How to generate account number? |
| Date | 2012-11-03 19:23 +0300 |
| References | <mailman.3220.1351890866.27098.python-list@python.org> <1gsdm9-r2c.ln1@crazy-horse.bildanet.com> <50953982.7090305@tim.thechases.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3245.1351959884.27098.python-list@python.org> (permalink) |
Tim,
Good point. b32decode seems to be capable to understand such common mistakes (see map01 argument to b32decode), I haven't tried:
http://docs.python.org/2/library/base64.html
Thanks.
Andriy
----------------------------------------
> Date: Sat, 3 Nov 2012 10:34:26 -0500
> From: python.list@tim.thechases.com
> To: roy@panix.com
> Subject: Re: How to generate account number?
> CC: python-list@python.org
>
> On 11/03/12 08:22, Roy Smith wrote:
> > Even better might be base-32 encoding the value. Strings of
> > digits have an information density of about 3.2 bits/char.
> > Base-32 is just about as readable, but gives you 5 bits/char, so
> > you end up with a few less characters (which you still want to
> > chunk into 3 or 4 character groups).
>
> For things that will be read off a screen/paper, I recommend
> omitting several letters that are easy to mistake visually: i/I/l/1
> and O/0 in particular. The VIN (vehicle identification number) on
> all US cars avoids these characters[*], making it easier to read
> them back without concern for "is that a zero or an oh; and is that
> an ell, a one, a lowercase eye, or a capital eye?" As an encoding
> advantage,
>
> >>> print len(''.join(c for c in (string.ascii_uppercase +
> string.digits) if c not in "O0iIl1"))
> 32
>
> the number 32 is pretty handy when dealing with binary :-)
>
> -tkc
>
>
> [*]
> The VIN avoids "Q" too and does use the digits 0/1, but the idea
> holds. Make it easy to ready back.
> --
> http://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to generate account number? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-03 00:13 +0300
Re: How to generate account number? GangGreene <GangGreene@example.com> - 2012-11-02 18:02 -0400
RE: How to generate account number? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-03 11:38 +0300
Re: How to generate account number? Roy Smith <roy@panix.com> - 2012-11-03 09:22 -0400
Re: How to generate account number? Tim Chase <python.list@tim.thechases.com> - 2012-11-03 10:34 -0500
RE: How to generate account number? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-03 19:18 +0300
RE: How to generate account number? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-03 19:23 +0300
Re: How to generate account number? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-02 22:39 +0000
RE: How to generate account number? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-03 11:42 +0300
csiph-web