Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.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.044 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'modified': 0.05; 'one?': 0.05; 'that?': 0.05; '(of': 0.07; 'identifier': 0.09; 'identifier,': 0.09; 'part,': 0.09; 'truncate': 0.09; 'recognizing': 0.16; 'truncating': 0.16; 'value.)': 0.16; 'value:': 0.16; '(or': 0.18; 'question.': 0.20; 'somebody': 0.23; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; '(since': 0.29; 'hash': 0.29; 'goes': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'bigger': 0.35; 'problem,': 0.35; 'received:192.168.0': 0.35; 'should': 0.36; 'thank': 0.36; 'bad': 0.37; 'two': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'most': 0.61; 'you.': 0.61; 'chance': 0.61; 'received:62': 0.62; 'different': 0.63; 'algorithm,': 0.84; 'received:192.168.0.101': 0.84; 'received:192.168.13': 0.84; 'received:192.168.13.238': 0.84; 'received:62.179': 0.84; 'received:62.179.121': 0.84; 'received:edge03.upcmail.net': 0.84; 'received:upcmail.net': 0.84; 'luck': 0.93 X-SourceIP: 89.134.225.226 Date: Thu, 26 Jul 2012 20:08:59 +0200 From: Laszlo Nagy User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Generating valid identifiers References: <50116281$0$29978$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <50116281$0$29978$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343326154 news.xs4all.nl 6955 [2001:888:2000:d::a6]:58023 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26106 >> * Would it be a problem to use CRC32 instead of SHA? (Since security is >> not a problem, and CRC32 is faster.) > What happens if you get a collision? > > That is, you have two different long identifiers: > > a.b.c.d...something > a.b.c.d...anotherthing > > which by bad luck both hash to the same value: > > a.b.c.d.$AABB99 > a.b.c.d.$AABB99 > > (or whatever). Yes, that was the question. How do I avoid that? (Of course I can avoid that by using a full sha256 hash value.) >> * Can somebody think of a >> better algorithm, that would give a bigger chance of recognizing the >> original identifier from the modified one? > Rather than truncating the most significant part of the identifier, the > field name, you should truncate the least important part, the middle. > > a.b.c.d.e.f.g.something > > goes to: > > a.b...g.something > > or similar. Yes, this is a good idea. Thank you.