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@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@python.org 
http://mail.python.org/mailman/listinfo/bangpypers
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to