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


Groups > comp.lang.python > #16497

Re: order independent hash?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'args': 0.05; 'character,': 0.07; 'python': 0.08; 'dict': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'thanks!': 0.14; 'ideas?': 0.16; 'set)': 0.16; 'sha1': 0.16; 'subject:independent': 0.16; 'wrote:': 0.18; 'digest': 0.19; 'command': 0.24; 'times,': 0.24; 'pm,': 0.29; 'hash': 0.30; 'subject:?': 0.31; 'list': 0.32; 'sort': 0.33; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'to:addr:python-list': 0.34; 'but': 0.37; 'using': 0.38; 'received:org': 0.38; 'first.': 0.39; 'should': 0.39; 'to:addr:python.org': 0.40; 'order': 0.62; 'received:139': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Neal Becker <ndbecker2@gmail.com>
Subject Re: order independent hash?
Date Thu, 01 Dec 2011 08:55:38 -0500
References <jb57p7$b1j$1@dough.gmane.org> <jb7ldj$s8v$2@dough.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host 139.85.237.19
User-Agent KNode/4.7.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.3198.1322747760.27778.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322747760 news.xs4all.nl 6890 [2001:888:2000:d::a6]:36395
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16497

Show key headers only | View raw


Gelonida N wrote:

> On 11/30/2011 01:32 PM, Neal Becker wrote:
>> I like to hash a list of words (actually, the command line args of my
>> program) in such a way that different words will create different hash, but
>> not sensitive
>> to the order of the words.  Any ideas?
>> 
> Do youmean hash like digest like md5sum / sha1 ?
> 
> 
> You should sort the words alphabetically, concatenate them with a space
> or any character, that will NEVER be part of a word and calulate the hash.
> 
> If words can exist multiple times, then youhad tu uniqufy them (u using
> a python dict / set) first.

Yes that sounds just like what I wanted - thanks!

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: order independent hash? Neal Becker <ndbecker2@gmail.com> - 2011-12-01 08:55 -0500

csiph-web