Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32703

RE: How to generate account number?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <andriy.kornatskyy@live.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'argument': 0.04; 'binary': 0.05; '-0500': 0.07; 'chunk': 0.07; 'subject:How': 0.09; 'subject:number': 0.09; 'to:addr:python.list': 0.09; 'to:addr:tim.thechases.com': 0.09; 'cc:addr:python-list': 0.10; ':-)': 0.13; 'encoding': 0.15; 'sat,': 0.15; 'value.': 0.15; '-tkc': 0.16; '[*]': 0.16; 'lowercase': 0.16; 'number?': 0.16; 'omitting': 0.16; 'roy': 0.16; 'tim,': 0.16; 'tried:': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'skip:- 40': 0.21; 'thanks.': 0.21; '3.2': 0.22; 'back.': 0.22; 'number)': 0.22; 'cc:2**0': 0.23; "haven't": 0.23; 'to:2**1': 0.23; 'seems': 0.23; 'idea': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; '(which': 0.26; 'common': 0.26; '(see': 0.27; 'skip:( 20': 0.28; 'concern': 0.29; 'date:': 0.29; 'url:mailman': 0.29; 'character': 0.29; 'url:python': 0.32; 'to:no real name:2**1': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'from:addr:live.com': 0.33; 'zero': 0.33; 'point.': 0.33; 'nov': 0.35; 'subject:?': 0.35; 'subject:': 0.36; 'but': 0.36; 'url:org': 0.36; 'characters': 0.36; 'url:library': 0.36; 'email addr:python.org': 0.36; 'too': 0.36; 'one,': 0.37; 'does': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'easier': 0.38; 'things': 0.38; 'url:docs': 0.38; 'several': 0.39; 'gives': 0.39; 'end': 0.40; 'url:mail': 0.40; 'easy': 0.60; 'back': 0.62; 'email name:python-list': 0.62; 'letters': 0.62; 'capable': 0.63; 'information': 0.63; 'making': 0.64; 'account': 0.67; 'capital': 0.68; 'smith': 0.71; 'subject:account': 0.74; 'email addr:panix.com': 0.84; 'eye,': 0.84; 'cars': 0.91; 'mistake': 0.91; 'mistakes': 0.95; 'charset:windows-1251': 0.97
X-Originating-IP [213.130.16.2]
From Andriy Kornatskyy <andriy.kornatskyy@live.com>
To <python.list@tim.thechases.com>, <roy@panix.com>
Subject RE: How to generate account number?
Date Sat, 3 Nov 2012 19:23:36 +0300
Importance Normal
In-Reply-To <50953982.7090305@tim.thechases.com>
References <mailman.3220.1351890866.27098.python-list@python.org> <1gsdm9-r2c.ln1@crazy-horse.bildanet.com> <50953982.7090305@tim.thechases.com>
Content-Type text/plain; charset="windows-1251"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-OriginalArrivalTime 03 Nov 2012 16:23:36.0717 (UTC) FILETIME=[93811BD0:01CDB9DF]
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3245.1351959884.27098.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351959884 news.xs4all.nl 6914 [2001:888:2000:d::a6]:53323
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32703

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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