Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.tele2net.at!newsfeed.utanet.at!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'elegant': 0.07; 'welcome.': 0.07; 'subject:How': 0.09; '(without': 0.09; 'email addr:example.com': 0.09; 'hashlib': 0.09; 'satisfy': 0.09; 'subject:number': 0.09; 'suggest': 0.11; 'sat,': 0.15; '(must': 0.16; 'call)': 0.16; 'number?': 0.16; 'readable': 0.16; 'sha1': 0.16; 'wrote:': 0.17; 'examples': 0.18; '>>>': 0.18; 'to:name :python-list@python.org': 0.20; 'skip:- 40': 0.21; 'import': 0.21; 'thanks.': 0.21; 'simpler': 0.22; "skip:' 40": 0.22; 'to:2**1': 0.23; 'random': 0.24; 'header:In-Reply-To:1': 0.25; 'date:': 0.29; 'url:mailman': 0.29; "skip:' 10": 0.30; 'fri,': 0.30; 'url:2012': 0.30; 'url:python': 0.32; 'url:listinfo': 0.32; 'comments': 0.33; 'from:addr:live.com': 0.33; 'to:addr:python-list': 0.33; 'requirements': 0.33; 'consistent': 0.35; 'nov': 0.35; 'subject:?': 0.35; 'subject:': 0.36; 'but': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; 'should': 0.36; 'too': 0.36; 'quite': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'easy': 0.60; 'here:': 0.62; 'email name:python-list': 0.62; 'more': 0.63; 'url:blogspot': 0.64; 'here': 0.65; 'records.': 0.65; 'account': 0.67; 'url:11': 0.71; 'subject:account': 0.74; 'humans.': 0.84; 'dozen': 0.91; 'interested?': 0.91; 'charset:windows-1251': 0.97 X-Originating-IP: [213.130.16.2] From: Andriy Kornatskyy To: , "python-list@python.org" Subject: RE: How to generate account number? Date: Sat, 3 Nov 2012 11:38:38 +0300 Importance: Normal In-Reply-To: <1gsdm9-r2c.ln1@crazy-horse.bildanet.com> References: , <1gsdm9-r2c.ln1@crazy-horse.bildanet.com> Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 03 Nov 2012 08:38:38.0382 (UTC) FILETIME=[9ECD04E0:01CDB99E] 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: 60 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351931985 news.xs4all.nl 6964 [2001:888:2000:d::a6]:34519 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32687 >>> from hashlib import sha1 >>> sha1('GangGreene-20120203-1012').hexdigest() 'ef764a2fe44532008dc9a99c391c70cd85ec9d82' It is too long and not verifiable. >>> from uuid import uuid4 >>> uuid4() UUID('2c14484b-5a0c-4f4b-b7bc-8187548b4888') Pretty much the same what you suggest but simpler and shorter. Not quite el= egant for humans. Here are examples per this post: http://mindref.blogspot.com/2012/11/generate-account-number.html >>> account_number(1) 'Z05738521581' >>> account_number(2) 'Z17888279480' >>> account_number(3) 'Z07395350007' Short=2C human readable and satisfy original requirements. Andriy ---------------------------------------- > From: GangGreene@example.com > Subject: Re: How to generate account number? > Date: Fri=2C 2 Nov 2012 18:02:09 -0400 > To: python-list@python.org > > On Sat=2C 03 Nov 2012 00:13:19 +0300=2C Andriy Kornatskyy wrote: > >> Requirements for `account number` generator: >> >> 1. Issue pseudo random consistent number (must be unique for dozen >> millions of records) >> 2. Easy check validity (without a need to make a database call) >> >> Interested? Read more here: >> >> http://mindref.blogspot.com/2012/11/generate-account-number.html >> >> Comments or suggestions are welcome. >> >> Thanks. >> >> Andriy Kornatskyy > > generate sha1sum on the ((key database record(s))+date+timeofday) > Should be unique for billions/trillions of records. > -- > http://mail.python.org/mailman/listinfo/python-list =