Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'binary': 0.05; 'chunk': 0.07; 'subject:How': 0.09; 'subject:number': 0.09; 'cc:addr :python-list': 0.10; ':-)': 0.13; 'encoding': 0.15; 'value.': 0.15; '-tkc': 0.16; '[*]': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'lowercase': 0.16; 'message-id:@tim.thechases.com': 0.16; 'omitting': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'roy': 0.16; 'wrote:': 0.17; '>>>': 0.18; '3.2': 0.22; 'back.': 0.22; 'number)': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'skip:( 20': 0.28; 'concern': 0.29; 'character': 0.29; 'print': 0.32; 'zero': 0.33; 'subject:?': 0.35; 'but': 0.36; 'characters': 0.36; 'too': 0.36; 'one,': 0.37; 'does': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'things': 0.38; 'several': 0.39; 'gives': 0.39; 'end': 0.40; 'easy': 0.60; 'back': 0.62; 'letters': 0.62; 'information': 0.63; 'making': 0.64; 'capital': 0.68; 'smith': 0.71; 'subject:account': 0.74; 'eye,': 0.84; 'received:50.22': 0.84; 'cars': 0.91; 'mistake': 0.91 Date: Sat, 03 Nov 2012 10:34:26 -0500 From: Tim Chase User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 MIME-Version: 1.0 To: Roy Smith Subject: Re: How to generate account number? References: <1gsdm9-r2c.ln1@crazy-horse.bildanet.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Source: X-Source-Args: X-Source-Dir: Cc: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351956818 news.xs4all.nl 6879 [2001:888:2000:d::a6]:38098 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32699 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.