[BangPypers] Hash function that returns unsigned integer

Yoganand Anandaraju yoganand at gmx.com
Mon Sep 3 11:38:25 CEST 2012


I found pyhash library. pyhash.murmur3_32() solved the problem.

 http://code.google.com/p/pyfasthash/
 http://code.google.com/p/smhasher/

----- Original Message -----
From: Philippe May
Sent: 08/31/12 07:26 PM
To: bangpypers at python.org
Subject: Re: [BangPypers] Hash function that returns unsigned integer

 The probability of getting non unique values is logically multiplied by 2 using the modulo method. If you don't mind dealing with long integers, you can simply add the absolute value of the minimum integer: hash(value) + sys.maxint + 1. In any case, i think it's better to use sys.maxint, instead of 2**32. > Will that be unique(near unique)? Want to make sure hashing someother string will not produce the same hash value. >> Just modulo the hash function `hash_value % (2**32)` >>> Is anyone aware of any non-cryptographic hash function whose value is only postive integer. Pythons inbuilt hash function is a signed integer. _______________________________________________ BangPypers mailing list BangPypers at python.org http://mail.python.org/mailman/listinfo/bangpypers


More information about the BangPypers mailing list