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

Reply via email to